diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2024-06-18 14:54:51 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-18 14:54:51 (GMT) |
commit | 1ce59849610fe03beebcddfacb3d055a7074ef16 (patch) | |
tree | 1000c3c2e89c99a3a77dd19fa640f2ebc4998cc1 /Misc/NEWS.d/next | |
parent | 4f4973d740839757e888c854a1994a64cb900d7b (diff) | |
download | cpython-1ce59849610fe03beebcddfacb3d055a7074ef16.zip cpython-1ce59849610fe03beebcddfacb3d055a7074ef16.tar.gz cpython-1ce59849610fe03beebcddfacb3d055a7074ef16.tar.bz2 |
[3.13] gh-118789: Add `PyUnstable_Object_ClearWeakRefsNoCallbacks` (GH-118807) (#120695)
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.
(cherry picked from commit e8752d7b80775ec2a348cd4bf38cbe26a4a07615)
Co-authored-by: Sam Gross <colesbury@gmail.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
Diffstat (limited to 'Misc/NEWS.d/next')
-rw-r--r-- | Misc/NEWS.d/next/C API/2024-05-08-21-57-50.gh-issue-118789.Ni4UQx.rst | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/Misc/NEWS.d/next/C API/2024-05-08-21-57-50.gh-issue-118789.Ni4UQx.rst b/Misc/NEWS.d/next/C API/2024-05-08-21-57-50.gh-issue-118789.Ni4UQx.rst new file mode 100644 index 0000000..32a9ec6 --- /dev/null +++ b/Misc/NEWS.d/next/C API/2024-05-08-21-57-50.gh-issue-118789.Ni4UQx.rst @@ -0,0 +1,2 @@ +Add :c:func:`PyUnstable_Object_ClearWeakRefsNoCallbacks`, which clears +weakrefs without calling their callbacks. |