[PyQt] SIP, object destruction, and sip.setdeleted

Kevin Watters kevin at digsby.com
Tue Apr 29 23:37:51 BST 2008

I've got a couple quick questions about SIP's handling of object destruction.

The docs for sip.setdeleted says

    This marks the C++ instance or C structure as having been destroyed or
returned to the heap so that future references to it raise an exception rather
than cause a program crash. Normally SIP handles such things automatically, but
there are circumstances where this isn't possible. obj is the Python object.

How does SIP handle this situation "automatically?" I don't see anything going
on in the release_XXX methods in my class wrappers, other than

    delete reinterpret_cast<XXX *>(ptr);

Also, some of my classes have a Destroy method whose implementation is to just
to call

delete this;

Without the SIP wrappers defining a virtual destructor of their own, is there
any way for SIP to recognize that it should mark any existing Python instances
as "deleted?"

More information about the PyQt mailing list