summaryrefslogtreecommitdiffstats
path: root/Include/internal
diff options
context:
space:
mode:
authorSam Gross <colesbury@gmail.com>2024-06-18 13:57:23 (GMT)
committerGitHub <noreply@github.com>2024-06-18 13:57:23 (GMT)
commite8752d7b80775ec2a348cd4bf38cbe26a4a07615 (patch)
treeaf381ff07ef5c47aa18731fb03d5eb88452a3189 /Include/internal
parent360f14a493d8461d42dc646be40b4b6fb20db57a (diff)
downloadcpython-e8752d7b80775ec2a348cd4bf38cbe26a4a07615.zip
cpython-e8752d7b80775ec2a348cd4bf38cbe26a4a07615.tar.gz
cpython-e8752d7b80775ec2a348cd4bf38cbe26a4a07615.tar.bz2
gh-118789: Add `PyUnstable_Object_ClearWeakRefsNoCallbacks` (#118807)
This exposes `PyUnstable_Object_ClearWeakRefsNoCallbacks` as an unstable C-API function to provide a thread-safe mechanism for clearing weakrefs without executing callbacks. Some C-API extensions need to clear weakrefs without calling callbacks, such as after running finalizers like we do in subtype_dealloc. Previously they could use `_PyWeakref_ClearRef` on each weakref, but that's not thread-safe in the free-threaded build. Co-authored-by: Petr Viktorin <encukou@gmail.com>
Diffstat (limited to 'Include/internal')
-rw-r--r--Include/internal/pycore_weakref.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/Include/internal/pycore_weakref.h b/Include/internal/pycore_weakref.h
index cc6c7ff..94aadb2 100644
--- a/Include/internal/pycore_weakref.h
+++ b/Include/internal/pycore_weakref.h
@@ -109,7 +109,7 @@ extern Py_ssize_t _PyWeakref_GetWeakrefCount(PyObject *obj);
// Clear all the weak references to obj but leave their callbacks uncalled and
// intact.
-extern void _PyWeakref_ClearWeakRefsExceptCallbacks(PyObject *obj);
+extern void _PyWeakref_ClearWeakRefsNoCallbacks(PyObject *obj);
PyAPI_FUNC(int) _PyWeakref_IsDead(PyObject *weakref);