[Pyrex] Subclassing a non-GC type

Eric Huss e-huss at netmeridian.com
Sat Jan 12 01:51:52 CET 2008


> 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.  You should also change the tp_free slot define from a
GCDependentSlot to EmptySlot (this is some 2.2 backwards compatibility
issue which I believe Pyrex no longer supports).  We didn't bother with
removing the tp_traverse/tp_clear definitions since Python will
essentially ignore them if HAVE_GC is not set.

-Eric



More information about the Pyrex mailing list