mirror of
https://github.com/python/cpython.git
synced 2025-12-10 11:00:14 +00:00
gh-128923: Use zero to indicate unassigned unique id (#128925)
In the free threading build, the per thread reference counting uses a unique id for some objects to index into the local reference count table. Use 0 instead of -1 to indicate that the id is not assigned. This avoids bugs where zero-initialized heap type objects look like they have a unique id assigned.
This commit is contained in:
parent
767c89ba7c
commit
d66c08aa75
9 changed files with 110 additions and 33 deletions
|
|
@ -6160,7 +6160,7 @@ type_dealloc(PyObject *self)
|
|||
Py_XDECREF(et->ht_module);
|
||||
PyMem_Free(et->_ht_tpname);
|
||||
#ifdef Py_GIL_DISABLED
|
||||
assert(et->unique_id == -1);
|
||||
assert(et->unique_id == _Py_INVALID_UNIQUE_ID);
|
||||
#endif
|
||||
et->ht_token = NULL;
|
||||
Py_TYPE(type)->tp_free((PyObject *)type);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue