Message396693
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. |
|
| Date |
User |
Action |
Args |
| 2021-06-29 01:43:49 | vstinner | set | recipients:
+ vstinner |
| 2021-06-29 01:43:49 | vstinner | set | messageid: <1624931029.33.0.65614185778.issue40142@roundup.psfhosted.org> |
| 2021-06-29 01:43:49 | vstinner | link | issue40142 messages |
| 2021-06-29 01:43:49 | vstinner | create | |
|