Skip to content

Conversation

@colesbury
Copy link
Contributor

@colesburycolesbury commented May 8, 2024

_PyWeakref_ClearRef was previously exposed in the public C-API, although it begins with an underscore and is not documented. It's used by a few C-API extensions. There is currently no alternative public API that can replace its use.

_PyWeakref_ClearRef was previously exposed in the public C-API, although it begins with an underscore and is not documented. It's used by a few C-API extensions. There is currently no alternative public API that can replace its use. _PyWeakref_ClearWeakRefsExceptCallbacks is the only thread-safe way to use _PyWeakref_ClearRef in the free-threaded build. This exposes the C symbol, but does not make the API public.
@colesburycolesbury added needs backport to 3.13 bugs and security fixes and removed skip news labels May 8, 2024
@colesbury
Copy link
ContributorAuthor

cc @albanD

Copy link
Contributor

@mpagempage left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My bad - LGTM!

Copy link
Member

@vstinnervstinner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be possible to only restore it in Python 3.13 and remove it (do nothing) in Python 3.14, since a replacement is added?

@encukou
Copy link
Member

Would it be possible to only restore it in Python 3.13 and remove it (do nothing) in Python 3.14, since a replacement is added?

That's a question for the C API workgroup.

AFAIK, the workflow for 3.13 is to restore the API that causes problems. I don't think 3.14 branching changes that.

Copy link
Member

@vstinnervstinner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@encukouencukou merged commit db5af7d into python:mainMay 10, 2024
@miss-islington-app
Copy link

Thanks @colesbury for the PR, and @encukou for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request May 10, 2024
_PyWeakref_ClearRef was previously exposed in the public C-API, although it begins with an underscore and is not documented. It's used by a few C-API extensions. There is currently no alternative public API that can replace its use. _PyWeakref_ClearWeakRefsExceptCallbacks is the only thread-safe way to use _PyWeakref_ClearRef in the free-threaded build. This exposes the C symbol, but does not make the API public. (cherry picked from commit db5af7d) Co-authored-by: Sam Gross <colesbury@gmail.com>
@bedevere-app
Copy link

GH-118903 is a backport of this pull request to the 3.13 branch.

@bedevere-appbedevere-appbot removed the needs backport to 3.13 bugs and security fixes label May 10, 2024
encukou pushed a commit that referenced this pull request May 10, 2024
…H-118903) gh-118789: Restore hidden `_PyWeakref_ClearRef` (GH-118797) _PyWeakref_ClearRef was previously exposed in the public C-API, although it begins with an underscore and is not documented. It's used by a few C-API extensions. There is currently no alternative public API that can replace its use. _PyWeakref_ClearWeakRefsExceptCallbacks is the only thread-safe way to use _PyWeakref_ClearRef in the free-threaded build. This exposes the C symbol, but does not make the API public. (cherry picked from commit db5af7d) Co-authored-by: Sam Gross <colesbury@gmail.com>
@JelleZijlstraJelleZijlstra mentioned this pull request May 28, 2024
@colesburycolesbury deleted the gh-118789-_PyWeakref_ClearRef branch July 16, 2024 19:58
Sign up for freeto 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.

4 participants

@colesbury@encukou@vstinner@mpage