This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author exarkun
Recipients docs@python, exarkun
Date 2012-10-11.13:10:20
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
There appears to be very little, if any, documentation about how to handle the list at tp_weaklistoffset for types supporting being weak referenced, particularly with respect to garbage collection.

Who owns the list?  Who owns the objects in the list?  Should the list be traversed by the extension type's tp_traverse?  Should it ever be INCREF'd or DECREF'd?  Does tp_dealloc have any responsibilities with respect to it?

From looking at CPython's own source, it appears that tp_traverse should not touch it (Yhg1s confirmed this on #python).  Cython, at least, appears to have come to an alternate conclusion though - it generates tp_traverse functions which visit the list (and provoke gc assertions to fail on Python 2.7 in debug mode).

Some documentation about what is correct to do would be excellent, and would make it easier to explain to Cython developers what they're doing wrong (or confirm that they're doing something right, in which case there are some more bugs to file against the CPython stdlib, since they do something different from Cython).
Date User Action Args
2012-10-11 13:10:21exarkunsetrecipients: + exarkun, docs@python
2012-10-11 13:10:21exarkunsetmessageid: <>
2012-10-11 13:10:21exarkunlinkissue16195 messages
2012-10-11 13:10:20exarkuncreate