[QGIS-Developer] Is it just me, or is sip totally broken?

Nyall Dawson nyall.dawson at gmail.com
Mon Jan 7 13:50:58 PST 2019


On Mon, 7 Jan 2019 at 21:11, Martin Dobias <wonder.sk at gmail.com> wrote:
>
> Hi Nyall
>
> I have seen that too with other QGIS registries, but I am not sure if
> it is actually broken in SIP or if this should be simply handled in a
> different way.
>
> My understanding is that SIP for an object has the "c++ part" and
> "python part". If we do not deal with subclasses, things seem to work
> nicely: if you pass object of type X to function "myfunc(X* x
> /Transfer/)" then the object gets ownership passed to C++, and then
> when in python the object gets out of scope, its "python part" get
> deleted because it is not necessary anymore and only the "c++ part"
> keeps on living (and will be deleted in c++ code. The trouble is when
> passing derived classes with /Transfer/ where the "python part" is
> actually important, but it still gets deleted.
>

I don't think this is by design though -- see
https://www.riverbankcomputing.com/pipermail/pyqt/2018-December/041177.html
, where Phil states that Transfer is *supposed* to work as we want it
to, and avoid the deletion of the Python part.

There's also this from today (same question):

https://www.riverbankcomputing.com/pipermail/pyqt/2019-January/041226.html

But I don't believe this is the solution -- to me it seems that our
super types are already sip.wrapper, and that this is the default (see
http://pyqt.sourceforge.net/Docs/sip4/directives.html#directive-%DefaultSupertype
)

Nyall


More information about the QGIS-Developer mailing list