summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorSam Gross <colesbury@gmail.com>2024-10-01 17:05:42 (GMT)
committerGitHub <noreply@github.com>2024-10-01 17:05:42 (GMT)
commitb48253852341c01309b0598852841cd89bc28afd (patch)
tree01282cac5ec10baf98a63b76b95041415f6e8048 /Objects
parent5aa91c56bf14c38b4c7f5ccaaa3cd24fe3fb0f04 (diff)
downloadcpython-b48253852341c01309b0598852841cd89bc28afd.zip
cpython-b48253852341c01309b0598852841cd89bc28afd.tar.gz
cpython-b48253852341c01309b0598852841cd89bc28afd.tar.bz2
gh-124218: Refactor per-thread reference counting (#124844)
Currently, we only use per-thread reference counting for heap type objects and the naming reflects that. We will extend it to a few additional types in an upcoming change to avoid scaling bottlenecks when creating nested functions. Rename some of the files and functions in preparation for this change.
Diffstat (limited to 'Objects')
-rw-r--r--Objects/typeobject.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
index 0e2d975..6484e89 100644
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -3932,7 +3932,7 @@ type_new_alloc(type_new_ctx *ctx)
et->ht_token = NULL;
#ifdef Py_GIL_DISABLED
- _PyType_AssignId(et);
+ et->unique_id = _PyObject_AssignUniqueId((PyObject *)et);
#endif
return type;
@@ -5026,7 +5026,7 @@ PyType_FromMetaclass(
#ifdef Py_GIL_DISABLED
// Assign a type id to enable thread-local refcounting
- _PyType_AssignId(res);
+ res->unique_id = _PyObject_AssignUniqueId((PyObject *)res);
#endif
/* Ready the type (which includes inheritance).
@@ -6080,7 +6080,7 @@ type_dealloc(PyObject *self)
Py_XDECREF(et->ht_module);
PyMem_Free(et->_ht_tpname);
#ifdef Py_GIL_DISABLED
- _PyType_ReleaseId(et);
+ _PyObject_ReleaseUniqueId(et->unique_id);
#endif
et->ht_token = NULL;
Py_TYPE(type)->tp_free((PyObject *)type);