Message396695
The PyType_GenericAlloc() function tracks the newly created object in the garbage collector (GC) as soon as memory is initialized, but before all object members are initialized.
If a GC collection happens before the object is fully initialized, the traverse function of the newly created object can crash.
This case is hypothetical for built-in types since their constructor should not trigger a GC collection. It is more likely in third party extensions and subclasses.
Anyway, I propose to add a new _PyType_AllocNoTrack() function which allocates memory without tracking the newly allocated object directly in the GC.
This function can be used to only track explicitly the object in the GC once it is fully initialized. |
|
Date |
User |
Action |
Args |
2021-06-29 02:02:58 | vstinner | set | recipients:
+ vstinner |
2021-06-29 02:02:58 | vstinner | set | messageid: <1624932178.77.0.0459304316784.issue44531@roundup.psfhosted.org> |
2021-06-29 02:02:58 | vstinner | link | issue44531 messages |
2021-06-29 02:02:58 | vstinner | create | |
|