Pythoncom does its conversions in oleargs.cpp in the source tree. My guess is that we are hitting a path causing one of the "*_AsLong" or similar functions to fail, returning -1, but we don't check that error condition. However, the best I can tell, the test suite does try and cover these cases (see win32com\test\testpycomtest.py and search for "ulong"). Also, things behave differently based on whether typeinfo is available - if it is not, Python "guesses" about the variant type based on the python type, but if it is known, python attempts to convert the python value to the requested type.
Can you provide any more info, or suggest how testpycomtest could be modified to demonstrate the problem? Mark From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Chen Sent: Friday, 22 February 2008 3:21 AM To: python-win32@python.org Subject: [python-win32] Data Type Conversion in Python Win32 COM Hello, I have a question regarding to how Data type is being converted into COM object. For example, there is a function A in one COM object that requires an Unsigned 32 bit Integer as a parameter. How could I pass a Long Integer in python to Function A. I found that if the parameter is smaller or equal to ( 2^31 -1 ), the parameter is correctly passed to Function A. Any value that bigger than ( 2 ^31 - 1) will be interpreted as 0xFFFFFFFF. Does Python Win32 COM has its own data conversion if the data type of the passed parameter is different from the data type of the required parameter. If yes, how python win32 COM does the conversion? Thanks Chen
_______________________________________________ python-win32 mailing list python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32