[Pyrex] Subclassing a non-GC type

Lenard Lindstrom len-l at telus.net
Sat Jan 12 18:59:54 CET 2008


Stefan Behnel wrote:
> Hi,
>
> Eric Huss wrote:
>   
>> 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.
>>     
>
> Hmm, I tried that and it also removed the HAVE_GC flag from /subtypes/ of GC
> enabled types. It seems to work, but I don't know if that's the right thing to
> do, as I suppose this would mean that the subtype can no longer be GC traversed.
>
> Does anyone have experience with this and can enlighten me here?
>
>   
Looking at the inherit_special function in typeobject.c I see that 
PyType_Ready promotes tp_traverse,  tp_clear and HAVE_GC.

-- 
Lenard Lindstrom
<len-l at telus.net>




More information about the Pyrex mailing list