[pywin32-checkins] pywin32/com/win32com/client dynamic.py, 1.32, 1.33
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
|
From: Roger U. <ru...@us...> - 2010-01-25 23:41:12
|
Update of /cvsroot/pywin32/pywin32/com/win32com/client In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv32617 Modified Files: dynamic.py Log Message: Fix display name of dynamic COM objects in Py3k Index: dynamic.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/client/dynamic.py,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** dynamic.py 22 Mar 2009 01:26:43 -0000 1.32 --- dynamic.py 25 Jan 2010 23:41:04 -0000 1.33 *************** *** 64,68 **** # A helper to create method objects on the fly ! if sys.version_info > (3,0): def MakeMethod(func, inst, cls): return types.MethodType(func, inst) # class not needed in py3k --- 64,69 ---- # A helper to create method objects on the fly ! py3k = sys.version_info > (3,0) ! if py3k: def MakeMethod(func, inst, cls): return types.MethodType(func, inst) # class not needed in py3k *************** *** 92,102 **** # displayed to the user in repr() etc. if userName is None: if isinstance(IDispatch, str): userName = IDispatch ! elif isinstance(IDispatch, unicode): ! # We always want the displayed name to be a real string userName = IDispatch.encode("ascii", "replace") ! elif type(userName) == unicode: ! # As above - always a string... userName = userName.encode("ascii", "replace") else: --- 93,106 ---- # displayed to the user in repr() etc. if userName is None: + # Displayed name should be a plain string in py2k, and unicode in py3k if isinstance(IDispatch, str): userName = IDispatch ! elif not py3k and isinstance(IDispatch, unicode): ! # 2to3 converts the above 'unicode' to 'str', but this will never be executed in py3k userName = IDispatch.encode("ascii", "replace") ! ## ??? else userName remains None ??? ! elif not py3k and isinstance(userName, unicode): ! # 2to3 converts the above 'unicode' to 'str', but this will never be executed in py3k ! # As above - always a plain string in py2k userName = userName.encode("ascii", "replace") else: |