[Python-Dev] C new-style classes and GC

Tim Peters tim@zope.com
Fri, 16 May 2003 14:12:12 -0400


[Guido]
> But calling tp_free is more correct.  This allows a subclass to change
> the memory allocation policy.  (This is also important if a base class
> is not collectible but a subclass is -- then it's essential that the
> base class dealloc handler calls tp_free.)

I think the scoop is that cyclic gc got added before new-style classes, so
at the time new-style classes were introduced *all* tp_dealloc slots for
gc'able types called the gc del function directly.  After that, I expect the
only ones that got changed were those reviewed (lists, tuples, dicts, ...)
as part of making test_descr.py's subclass-from-builtin tests work.

Jeremy is rummaging thru current CVS now changing the others (frames,
functions, ...).  Does this count as a bugfix, i.e. should it be backported
to 2.2.3?