mirror of
https://github.com/python/cpython.git
synced 2026-05-06 12:49:07 -04: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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user