[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    Re: [PyQt] sip: how to make a python instance owned by C++ without using a parent
From:       Mathias.Born () gmx ! de
Date:       2012-08-27 20:08:13
Message-ID: 1601533293.20120827220813 () gmx ! de
[Download RAW message or body]

On 27.08.2012, 22:50:43 Phil Thompson wrote:
> On Sun, 26 Aug 2012 21:11:50 +0200, Mathias.Born@gmx.de wrote:
>> On 26.08.2012, 18:15:55 Phil Thompson wrote:
>>> On Wed, 15 Aug 2012 11:55:47 +0200, Mathias.Born@gmx.de wrote:
>>>> On 15.08.2012, 11:05:42 Phil Thompson wrote:
>>>>> I could change sipTransferTo() to do this if the owner was Py_None.
> At
>>>>> the
>>>>> moment this is undocumented behaviour. Would this be sufficient?
>>>> 
>>>> I believe so.
>> 
>>> Done in hg.
>> 
>> Phil,
>> 
>> First tests show that this works well. It's an important feature, but
>> burried deeply in the documentation, well, actually sort of obscured.
>> 
>> Function "sipConvertToType" is documented as:
>> 
>> If transferObj is NULL then the ownership is unchanged. If it is Py_None
>> then
>> ownership is transferred to Python via a call to sipTransferBack().
>> Otherwise ownership is transferred to C/C++ and obj associated with
>> transferObj via a call to sipTransferTo().
>> 
>> Function "sipTransferTo" tells us:
>> ... If owner is Py_None then obj is given an extra reference which is
>> removed when the C++ instance's destructor is called. ...
>> 
>> 
>> Since "sipTransferTo" is mentioned by the docs of "sipConvertToType",
> who
>> would guess that Py_None has such a different meaning?
>> 
>> How about adding a corresponding hint to the documentation
>> of "sipConvertToType"?

> I'm not sure that adding documentation to something about what it doesn't
> do makes anything clearer.

> Phil

That's because you are far too familiar with sip :-)

I imagine adding something like

"Note that obj can also be managed by the C++ instance itself, but this
can only be achieved by using sipTransferTo."

to the documentation of "sipConvertToType".

Best Regards,
Mathias Born

_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic