[pywin32-bugs] [ pywin32-Bugs-3152800 ] gen_py fails to map type correctly
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: SourceForge.net <no...@so...> - 2011-04-23 12:43:35
|
Bugs item #3152800, was opened at 2011-01-07 18:57 Message generated for change (Comment added) made by mhammond You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=551954&aid=3152800&group_id=78018 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: com Group: None >Status: Closed >Resolution: Fixed Priority: 5 Private: No Submitted By: Klaus Noekel (kahlbutz) Assigned to: Nobody/Anonymous (nobody) Summary: gen_py fails to map type correctly Initial Comment: Hi, I am calling a COM server (written in C++) from Python. The COM server defines methods: interface IMatrix : IDispatch { ... [id(14), helpstring ("Copy matrix contents to a pointer to a C-style 2D double array")] HRESULT GetValuesRaw ( [in] unsigned int hi, [in] unsigned int lo); [id(15), helpstring ("Copy matrix contents from a pointer to a C-style 2D double array")] HRESULT SetValuesRaw ( [in] unsigned int hi, [in] unsigned int lo); } Pywin32 does not pick up the unsigned int, but generates def GetValuesRaw(self, hi=defaultNamedNotOptArg, lo=defaultNamedNotOptArg): """Copy matrix contents to a pointer to a C-style 2D double array""" return self._oleobj_.InvokeTypes(14, LCID, 1, (24, 0), ((3, 1), (3, 1)),hi , lo) where the type id 3 stands for VT_I4 instead of VT_UI4. As you would expect this fails the first time bit 31 of hi or lo is set. Is it a bug in pywin32? If not, how can I influence gen_py so that it correctly recognizes the type? Do I have to write the IDL differently? Can I include hints? Finally, what I really want to achieve is pass a 64-bit pointer from Python to the C++ COM server. Splitting it into the 32-bit hi/lo parts and passing them separately is my current solution. Am I overlooking a better option? Thanks and best regards, Klaus Noekel ---------------------------------------------------------------------- >Comment By: Mark Hammond (mhammond) Date: 2011-04-23 22:43 Message: Thanks for the report! Investigating this shows you are 100% correct and also led me to another bug - that OverFlowError exceptions passing too large integers are ignored with -1 silently passed. Fixed and checked into hg with tests as of 62ea09011278 ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=551954&aid=3152800&group_id=78018 |