[pywin32-checkins] pywin32/com/win32com/client build.py,1.26,1.27
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: Mark H. <mha...@us...> - 2004-04-09 11:34:32
|
Update of /cvsroot/pywin32/pywin32/com/win32com/client In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28398 Modified Files: build.py Log Message: Fix handling of names with leading '_', to avoid issues with Python's private attribute mangling. Index: build.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/client/build.py,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** build.py 31 Mar 2004 23:27:01 -0000 1.26 --- build.py 9 Apr 2004 11:21:13 -0000 1.27 *************** *** 492,495 **** --- 492,502 ---- valid_identifier_chars = string.letters + string.digits + "_" + def demunge_leading_underscores(className): + i = 0 + while className[i] == "_": + i += 1 + assert i >= 2, "Should only be here with names starting with '__'" + return className[i-1:] + className[:i-1] + # Given a "public name" (eg, the name of a class, function, etc) # make sure it is a legal (and reasonable!) Python name. *************** *** 503,507 **** # overwrite a builtin - eg, "None" if className[:2]=='__': ! return className[1:] + '_' # First '_' moved at the end. elif iskeyword(className): # all keywords are lower case return string.capitalize(className) --- 510,514 ---- # overwrite a builtin - eg, "None" if className[:2]=='__': ! return demunge_leading_underscores(className) elif iskeyword(className): # all keywords are lower case return string.capitalize(className) |