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 vstinner
Recipients vstinner
Date 2021-06-29.01:43:49
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1624931029.33.0.65614185778.issue40142@roundup.psfhosted.org>
In-reply-to
Content
PyType_GenericAlloc() cannot traverse the object since the object members are not initialized yet. For example, dict_traverse() can only be called when PyDict_New() completes.

A different approach would be to:

* (1) Add PyType_AllocNoTrack(), use it in built-in types, and call _PyObject_GC_TRACK() on the instance once it is fully initialized.
* (2) Modify PyType_GenericAlloc() to use a new variant of _PyObject_GC_TRACK() which will not traverse the instance.
* (3) Modify _PyObject_GC_TRACK() to traverse the instance.

In short, PyType_GenericAlloc() cannot be modified for backward compatibility.

Moreover, _PyObject_GC_TRACK() should only be used inside Python internals, since it's part the internal C API.
History
Date User Action Args
2021-06-29 01:43:49vstinnersetrecipients: + vstinner
2021-06-29 01:43:49vstinnersetmessageid: <1624931029.33.0.65614185778.issue40142@roundup.psfhosted.org>
2021-06-29 01:43:49vstinnerlinkissue40142 messages
2021-06-29 01:43:49vstinnercreate