[pywin32-checkins] pywin32/com/win32com/client genpy.py,1.36,1.37 build.py,1.24,1.25
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: <mha...@us...> - 2003-11-25 10:43:16
|
Update of /cvsroot/pywin32/pywin32/com/win32com/client In directory sc8-pr-cvs1:/tmp/cvs-serv11339 Modified Files: genpy.py build.py Log Message: Fix a bug where function names that were also builtin names were changed, causing needless errors in existing code that used functions called, eg, "open". Constant names that maktch builtin names are still mangled. Index: genpy.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/client/genpy.py,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** genpy.py 28 Oct 2003 21:26:45 -0000 1.36 --- genpy.py 25 Nov 2003 10:43:10 -0000 1.37 *************** *** 24,28 **** error = "makepy.error" ! makepy_version = "0.4.8" # Written to generated file. GEN_FULL="full" --- 24,28 ---- error = "makepy.error" ! makepy_version = "0.4.9" # Written to generated file. GEN_FULL="full" *************** *** 215,219 **** else: use = repr(str(val)) ! print "\t%-30s=%-10s # from enum %s" % (build.MakePublicAttributeName(name), use, enumName) class VTableItem(build.VTableItem, WritableItem): --- 215,220 ---- else: use = repr(str(val)) ! print "\t%-30s=%-10s # from enum %s" % \ ! (build.MakePublicAttributeName(name, True), use, enumName) class VTableItem(build.VTableItem, WritableItem): Index: build.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/client/build.py,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** build.py 23 Oct 2003 07:15:30 -0000 1.24 --- build.py 25 Nov 2003 10:43:11 -0000 1.25 *************** *** 494,498 **** # Given a "public name" (eg, the name of a class, function, etc) # make sure it is a legal (and reasonable!) Python name. ! def MakePublicAttributeName(className): # Given a class attribute that needs to be public, convert it to a # reasonable name. --- 494,498 ---- # Given a "public name" (eg, the name of a class, function, etc) # make sure it is a legal (and reasonable!) Python name. ! def MakePublicAttributeName(className, is_global = False): # Given a class attribute that needs to be public, convert it to a # reasonable name. *************** *** 500,508 **** # create duplicates - eg, just removing a leading "_" is likely to cause # a clash. if className[:2]=='__' and className[-2:]!='__': return className[1:] + '_' # First '_' moved at the end. elif iskeyword(className): # all keywords are lower case return string.capitalize(className) ! elif __builtins__.has_key(className): # builtins may be mixed case. If capitalizing it doesn't change it, # force to all uppercase (eg, "None", "True" become "NONE", "TRUE" --- 500,510 ---- # create duplicates - eg, just removing a leading "_" is likely to cause # a clash. + # if is_global is True, then the name is a global variable that may + # overwrite a builtin - eg, "None" if className[:2]=='__' and className[-2:]!='__': return className[1:] + '_' # First '_' moved at the end. elif iskeyword(className): # all keywords are lower case return string.capitalize(className) ! elif is_global and __builtins__.has_key(className): # builtins may be mixed case. If capitalizing it doesn't change it, # force to all uppercase (eg, "None", "True" become "NONE", "TRUE" |