[Pyrex] [Cython-dev] Subclassing a non-GC type

Stefan Behnel stefan_ml at behnel.de
Sat Jan 12 11:35:56 CET 2008


Hi,

Stefan Behnel wrote:
> Eric Huss wrote:
>>> BTW, shouldn't we in turn drop these two functions (and TPFLAGS_HAVE_GC) for
>>> extension types that do not have Python object members? If this is the only
>>> difference, I don't see why they should be there.
>> It looks like Greg was going to implement this, but didn't finish it.
>>
>> We have a patched version of Pyrex that essentially does this.  In
>> TypeSlots.py, there is a commented out bit to handle this (look for if
>> scope.has_pyobject_attrs where it sets the HAVE_GC flag).  We uncommented
>> that (and removed HAVE_GC from the default list), and it is working well
>> for us.
> 
> That's good to know, thanks. I'll look into this.

So, here's a patch that clears the GC functions (tp_traverse/clear) in the
type struct and avoids generating them if the type doesn't require GC support.

There was astonishingly little to change, all the logic was there already. I
wonder why Greg didn't go all the way at the time. Greg?

Stefan

-------------- next part --------------
A non-text attachment was scrubbed...
Name: lift-gc-support.patch
Type: text/x-patch
Size: 4670 bytes
Desc: not available
Url : http://lists.copyleft.no/pipermail/pyrex/attachments/20080112/280e8de7/attachment.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: lift-gc-support.bundle
Type: application/octet-stream
Size: 8303 bytes
Desc: not available
Url : http://lists.copyleft.no/pipermail/pyrex/attachments/20080112/280e8de7/attachment.obj 


More information about the Pyrex mailing list