mirror of
https://github.com/python/cpython.git
synced 2025-08-23 18:24:46 +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
|
@ -1911,7 +1911,7 @@ code_dealloc(PyObject *self)
|
|||
Py_XDECREF(co->co_linetable);
|
||||
Py_XDECREF(co->co_exceptiontable);
|
||||
#ifdef Py_GIL_DISABLED
|
||||
assert(co->_co_unique_id == -1);
|
||||
assert(co->_co_unique_id == _Py_INVALID_UNIQUE_ID);
|
||||
#endif
|
||||
if (co->_co_cached != NULL) {
|
||||
Py_XDECREF(co->_co_cached->_co_code);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue