Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-118789: Restore hidden _PyWeakref_ClearRef #118797

Merged
merged 4 commits into from
May 10, 2024

Conversation

colesbury
Copy link
Contributor

@colesbury colesbury 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.
@colesbury colesbury added needs backport to 3.13 bugs and security fixes and removed skip news labels May 8, 2024
@colesbury
Copy link
Contributor Author

cc @albanD

Copy link
Contributor

@mpage mpage 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

@vstinner vstinner 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?

Include/cpython/weakrefobject.h Outdated Show resolved Hide resolved
@encukou
Copy link
Member

encukou commented May 9, 2024

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

@vstinner vstinner left a comment

Choose a reason for hiding this comment

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

LGTM

@encukou encukou merged commit db5af7d into python:main May 10, 2024
36 checks passed
@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

bedevere-app bot commented May 10, 2024

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

@bedevere-app bedevere-app bot 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>
@colesbury colesbury deleted the gh-118789-_PyWeakref_ClearRef branch July 16, 2024 19:58
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.

4 participants