GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-118789: Restore hidden `_PyWeakref_ClearRef` by colesbury · Pull Request #118797 · python/cpython

Conversation

@colesbury

@colesbury colesbury commented May 8, 2024 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

_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.

  • Issue: _PyWeakref_ClearRef and _PyWeakref_ClearWeakRefsExceptCallbacks should be exposed in 3.13 #118789

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@colesbury
pythongh-118789: Restore hidden _PyWeakref_ClearRef
0d5ae9b
_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 topic-C-API topic-free-threading labels May 8, 2024
@colesbury
colesbury requested review from encukou and mpage May 8, 2024 20:09
@bedevere-app bedevere-app Bot added the awaiting core review label May 8, 2024
@colesbury colesbury added skip news and removed awaiting core review labels May 8, 2024
@bedevere-app bedevere-app Bot mentioned this pull request May 8, 2024
_PyWeakref_ClearRef and _PyWeakref_ClearWeakRefsExceptCallbacks should be exposed in 3.13 #118789
Closed
@colesbury
colesbury requested a review from vstinner May 8, 2024 20:11
@colesbury
Blurb
1cd8d00
@colesbury colesbury added needs backport to 3.13 only security fixes and removed skip news labels May 8, 2024
@colesbury

colesbury commented May 8, 2024

Copy link
Copy Markdown
Contributor Author

cc @albanD

albanD reacted with heart emoji
All reactions
  • ❤️ 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

mpage
mpage approved these changes May 8, 2024
View reviewed changes

@mpage mpage left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

My bad - LGTM!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@bedevere-app bedevere-app Bot added the awaiting core review label May 8, 2024
@colesbury
Only address _PyWeakref_ClearRef in this PR
bad74c2
vstinner
vstinner reviewed May 9, 2024
View reviewed changes

@vstinner vstinner left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this 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?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Include/cpython/weakrefobject.h Resolved

Uh oh!

There was an error while loading. Please reload this page.

@encukou

encukou commented May 9, 2024

Copy link
Copy Markdown
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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

encukou
encukou approved these changes May 9, 2024
View reviewed changes
@bedevere-app bedevere-app Bot added awaiting merge and removed awaiting core review labels May 9, 2024
@colesbury
Move definition up to match 3.12
35a62af
vstinner
vstinner approved these changes May 10, 2024
View reviewed changes

@vstinner vstinner left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

LGTM

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@encukou
encukou merged commit db5af7d into python:main May 10, 2024
@miss-islington-app

miss-islington-app Bot commented May 10, 2024

Copy link
Copy Markdown

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot removed the awaiting merge label May 10, 2024
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request May 10, 2024
@colesbury @miss-islington
pythongh-118789: Restore hidden _PyWeakref_ClearRef (pythonGH-118797)
c291cf8
_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 <[email protected]>
@bedevere-app

bedevere-app Bot commented May 10, 2024

Copy link
Copy Markdown

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot removed the needs backport to 3.13 only security fixes label May 10, 2024
encukou pushed a commit that referenced this pull request May 10, 2024
@miss-islington @colesbury
[3.13] gh-118789: Restore hidden _PyWeakref_ClearRef (GH-118797) (G…
bb5bf24
…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 <[email protected]>
@JelleZijlstra JelleZijlstra mentioned this pull request May 28, 2024
backport a9a74da 3.13 #119642
Closed
@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

Reviewers

@vstinner vstinner vstinner approved these changes
@encukou encukou encukou approved these changes
@mpage mpage mpage approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

topic-C-API topic-free-threading

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@colesbury @encukou @vstinner @mpage
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.