]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-128923: Use zero to indicate unassigned unique id (#128925)
authorSam Gross <colesbury@gmail.com>
Fri, 17 Jan 2025 15:42:27 +0000 (10:42 -0500)
committerGitHub <noreply@github.com>
Fri, 17 Jan 2025 15:42:27 +0000 (16:42 +0100)
commitd66c08aa757f221c0e8893300edac105dfcde7e8
treea5b1afb129b5782fe20057cad446789a88756d14
parent767c89ba7c5a70626df6e75eb56b546bf911b997
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.
Include/internal/pycore_dict.h
Include/internal/pycore_object.h
Include/internal/pycore_uniqueid.h
Lib/test/test_capi/test_type.py
Modules/_testcapimodule.c
Objects/codeobject.c
Objects/dictobject.c
Objects/typeobject.c
Python/uniqueid.c