Cyclic GC rules for subtyped objects with tp_dictoffset
bchess at gmail.com
Tue Mar 31 07:17:06 CEST 2009
I'm writing a new PyTypeObject that is base type, supports cyclic GC,
and has a tp_dictoffset. If my type is sub-typed by a python class,
what exactly are the rules for how I'm supposed to treat my PyDict
object with regards to cyclic GC? Do I still visit it in my traverse
() function if I'm subtyped? Do I decrement the refcount upon
dealloc? By the documentation, I'm assuming I should always be using
_PyObject_GetDictPtr() to be accessing the dictionary, which I do.
But visiting the dictionary in traverse() in the case it's subtyped
results in a crash in weakrefobject.c. I'm using Python 2.5.
Thanks for any help anyone has!
More information about the Python-list