mirror of
https://github.com/python/cpython.git
synced 2024-12-01 03:01:36 +01:00
4b63cd170e
The `PyStructSequence` destructor would crash if it was deallocated after its type's dictionary was cleared by the GC, because it couldn't compute the "real size" of the instance. This could occur with relatively straightforward code in the free-threaded build or with a reference cycle involving the type in the default build, due to differing orders in which `tp_clear()` was called. Account for the non-sequence fields in `tp_basicsize` and use that, along with `Py_SIZE()`, to compute the "real" size of a `PyStructSequence` in the dealloc function. This avoids the accesses to the type's dictionary during dealloc, which were unsafe. |
||
---|---|---|
.. | ||
Build | ||
C API | ||
C_API | ||
Core and Builtins | ||
Core_and_Builtins | ||
Documentation | ||
IDLE | ||
Library | ||
macOS | ||
Security | ||
Tests | ||
Tools-Demos | ||
Windows |