[PyQt] sip 4.8.2 error: sip: Unsupported type argument to type2string()

Phil Thompson phil at riverbankcomputing.com
Mon Aug 31 22:49:29 BST 2009


On Fri, 28 Aug 2009 14:47:29 +0200, "Diez B. Roggisch" <deets at web.de>
wrote:
> Hi,
> 
> 
> as always, your support is plain awesome!
> 
> See below for a follow-up-question:
> 
>>> the subject pretty much says it all. I upgraded to the latest SIP 
>>> because I experienced a strange endless-loop-kind of behavior in the 
>>> 4.7.* I had before, and now my building bails out with the
>>>
>>>   sip: Unsupported type argument to type2string()
>>>
>>> error message.
>>>
>>> You can find the mercurial repository at
>>>
>>>   https://bitbucket.org/deets/irrsinn/
>>>
>>> Any ideas?
>> 
>> Two changes in tonight's snapshot...
>> 
>> ...to fix the type2string() problem
>> 
>> ...to detect recursive class hierarchies - it's now obvious what's
>> causing
>> your looping.
> 
> 
> Great, I've been bitten by that before - but this time there was quite a 
> bit of time between altering the source, and trying to compile it again, 
> so I forgot.
> 
>> You also have a couple of syntax errors - forgetting the // around
>> annotations.
> 
> 
> Yep, saw these - it was the first time I was using them anyway, and thus 
>   I hadn't the syntax down.
> 
> And the reason I started with them is that I have a 
> memory-management-issue that is beyond my current understanding.
> 
> The library I'm wrapping employs it's own refcounting-scheme. The calls 
> "grab" and "drop" are used to in- and decrease the refcounter.
> 
> Now this leaves me with the problem that
> 
>   - when I drop() an object, it get's garbage-collected by C++ - but 
> Python keeps a reference, and will of course attempt to de-allocate the 
> object again.

Not if it thinks the C++ object is owned by C++.

>   - when I *don't* drop(), and the object is GC'ed by python, there 
> should be an implicit drop() called. I don't see a special method 
> "__del__" which I could use to do that.

%GCClearCode might do the job.

> So - any suggestions how to tie these two memory-management-systems 
> together?

Are you expecting the Python programmer to have to call grab() and drop()?
If so then the Python implementations should use sipTransferBack(),
sipTransferTo().

If you want it to happen automatically (as happens with PyQt) then you have
to use /Transfer/ and related annotations everywhere it happens.

Phil


More information about the PyQt mailing list