FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

[3.13] gh-118789: Add `PyUnstable_Object_ClearWeakRefsNoCallbacks` (GH-118807) by miss-islington · Pull Request #120695 · python/cpython · GitHub

/ cpython Public

[3.13] gh-118789: Add PyUnstable_Object_ClearWeakRefsNoCallbacks (GH-118807) - #120695

Merged
colesbury merged 1 commit into
python:3.13from
miss-islington:backport-e8752d7-3.13
Jun 18, 2024
Merged

[3.13] gh-118789: Add PyUnstable_Object_ClearWeakRefsNoCallbacks (GH-118807)#120695
colesbury merged 1 commit into
python:3.13from
miss-islington:backport-e8752d7-3.13

Conversation

miss-islington commented Jun 18, 2024
edited by github-actions Bot
Loading

Copy link
Copy Markdown
Contributor

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 e8752d7)

Co-authored-by: Sam Gross colesbury@gmail.com
Co-authored-by: Petr Viktorin encukou@gmail.com


📚 Documentation preview 📚: https://cpython-previews--120695.org.readthedocs.build/

…thonGH-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.

(cherry picked from commit e8752d7)

Co-authored-by: Sam Gross <colesbury@gmail.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL