[PyQt] Sip wrapping error

Phil Thompson phil at riverbankcomputing.com
Fri Feb 19 09:55:14 GMT 2010


On Fri, 19 Feb 2010 10:42:51 +0100, Sébastien Petitdemange
<sebastien.petitdemange at esrf.fr> wrote:
> Hi Phil,
> 
> We use the latest sip (4.10) to wrap your C++ library and I think I
> found a bug in the wrapping code generated by sip.
> 
> Sip Code:
> 
> class HwSyncCtrlObj
> {
> %TypeHeaderCode
> #include <HwSyncCtrlObj.h>
> using namespace lima;
> %End
> public:
> 	struct ValidRangesType
> 	{
> 	  double min_exp_time;
> 	  double max_exp_time;
> 	  double min_lat_time;
> 	  double max_lat_time;
> 	  const char* __repr__();
> %MethodCode
> std::ostringstream str;
> str << *sipCpp;
> sipRes = str.str().c_str();
> %End
> 	};
> 
> 	virtual void getValidRanges(HwSyncCtrlObj::ValidRangesType& range
> /Out/) = 0;
> };
> 
> C++ Code result:
> 
> void sipVH_lima_8(sip_gilstate_t sipGILState,PyObject
> *sipMethod,HwSyncCtrlObj::ValidRangesType& a0)
> {
>     PyObject *resObj = sipCallMethod(0,sipMethod,"");
> 
>     if (!resObj ||
>
sipParseResult(0,sipMethod,resObj,"D4",sipType_HwSyncCtrlObj_ValidRangesType,&a0)
> < 0)
>         PyErr_Print();
> 
>     Py_XDECREF(resObj);
>     Py_DECREF(sipMethod);
> 
>     SIP_RELEASE_GIL(sipGILState)
> }
> 
> We try to get the pointer of a0 instead of the reference!
> 
> Is it a bug or miss I something?

If you are referring to the use of &a0 in the call to sipParseResult() then
that is correct.

Phil


More information about the PyQt mailing list