[Cython] Surprising behaviour wrt. generated tp_clear and tp_dealloc functions

Stefan Behnel stefan_ml at behnel.de
Tue Apr 23 08:01:19 CEST 2013


Greg Ewing, 23.04.2013 01:16:
> Stefan Behnel wrote:
>> Torsten Landschoff, 22.04.2013 13:07:
>>> One could even think about building a graph of possible object
>>> relationships ...  Slot refers only to Slots and Slots only to Context, so
>>> these can't build a cycle.
>>
>> Interesting. Yes, that might work.
> 
> Only if subclassing of Slot and Context are forbidden.

Right. Subtypes of a non-GC type can happily add attributes and start
supporting cyclic garbage collection, including Python subclasses. So this
only applies to "final" types and builtins. Not entirely uncommon,
especially in the "keep this private thing alive until all referrers have
died" use case, but I's say this restriction drops the priority a bit.

Stefan



More information about the cython-devel mailing list