Thanks to visit codestin.com
Credit goes to github.com

Skip to content

gh-156762: Fix tp_clear slot signature for operator.methodcaller - #156769

Merged
vstinner merged 6 commits into
python:mainfrom
ashm-dev:issue-156762
Sep 13, 2026
Merged

gh-156762: Fix tp_clear slot signature for operator.methodcaller#156769
vstinner merged 6 commits into
python:mainfrom
ashm-dev:issue-156762

Conversation

@ashm-dev

@ashm-dev ashm-dev commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

@ashm-dev

ashm-dev commented Sep 1, 2026

Copy link
Copy Markdown
Contributor Author

@sergey-miryanov, could you please take a look at this PR?

@sergey-miryanov sergey-miryanov left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code looks good to me

@ashm-dev

Copy link
Copy Markdown
Contributor Author

@vstinner one-line tp_clear signature fix, approved by Sergey, CI green. Needs a core review.

@vstinner vstinner left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Sadly, the modified code is not tested by python -m test test_operator, so if the code is modified in the future, we can fail to catch regressions.

Please add a test to test_operator which does something like:

import gc, operator
class C: pass
c = C()
c.m = operator.methodcaller('foo', c)
del c
gc.collect()

@ashm-dev

Copy link
Copy Markdown
Contributor Author

@vstinner Thanks for the review. The test has been added.

@ashm-dev
ashm-dev requested a review from vstinner September 12, 2026 18:29
Comment thread Lib/test/test_operator.py
@ashm-dev
ashm-dev requested a review from vstinner September 13, 2026 07:45
@vstinner

Copy link
Copy Markdown
Member

The Docs CI failed with an error that I don't understand: KeyError: 'soft-deprecated'. So I updated the branch to see if it does fix or work around the Docs issue.

@vstinner vstinner left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@vstinner vstinner added needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes needs backport to 3.15 pre-release feature fixes, bugs and security fixes labels Sep 13, 2026
@vstinner
vstinner enabled auto-merge (squash) September 13, 2026 18:24
@vstinner
vstinner merged commit a4ca6e8 into python:main Sep 13, 2026
64 checks passed
@miss-islington-app

Copy link
Copy Markdown

Thanks @ashm-dev for the PR, and @vstinner for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14, 3.15.
🐍🍒⛏🤖

@bedevere-app

bedevere-app Bot commented Sep 13, 2026

Copy link
Copy Markdown

GH-157448 is a backport of this pull request to the 3.15 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.15 pre-release feature fixes, bugs and security fixes label Sep 13, 2026
@miss-islington-app

Copy link
Copy Markdown

Sorry, @ashm-dev and @vstinner, I could not cleanly backport this to 3.13 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker a4ca6e8d4b5d20b18e0f0eece32bd30968db7470 3.13

@bedevere-app

bedevere-app Bot commented Sep 13, 2026

Copy link
Copy Markdown

GH-157449 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.14 bugs and security fixes label Sep 13, 2026
@ashm-dev
ashm-dev deleted the issue-156762 branch September 13, 2026 18:58
vstinner added a commit that referenced this pull request Sep 13, 2026
…er() (GH-156769) (#157449)

gh-156762: Fix tp_clear slot signature for operator.methodcaller() (GH-156769)
(cherry picked from commit a4ca6e8)

Co-authored-by: Shamil <[email protected]>
Co-authored-by: Victor Stinner <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs backport to 3.13 bugs and security fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants