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-156762: Fix tp_clear slot signature for operator.methodcaller by ashm-dev · Pull Request #156769 · python/cpython

Conversation

@ashm-dev

@ashm-dev ashm-dev commented Sep 1, 2026 •
edited by bedevere-app Bot
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor
  • Issue: _operator: methodcaller_clear has the wrong signature for the tp_clear slot (returns void, not int) #156762

Sorry, something went wrong.

Uh oh!

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

All reactions
@ashm-dev
Fix tp_clear slot signature for operator.methodcaller
f7c623b
@bedevere-app bedevere-app Bot mentioned this pull request Sep 1, 2026
_operator: methodcaller_clear has the wrong signature for the tp_clear slot (returns void, not int) #156762
Closed
@bedevere-app bedevere-app Bot added the awaiting review label Sep 1, 2026
@ashm-dev
Merge branch 'main' into issue-156762
482f455
@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?

All reactions

Sorry, something went wrong.

Uh oh!

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

sergey-miryanov
sergey-miryanov approved these changes Sep 1, 2026
View reviewed changes

@sergey-miryanov sergey-miryanov 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.

Code looks good to me

Sorry, something went wrong.

Uh oh!

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

All reactions
@bedevere-app bedevere-app Bot added awaiting core review and removed awaiting review labels Sep 1, 2026
@ashm-dev

ashm-dev commented Sep 11, 2026

Copy link
Copy Markdown
Contributor Author

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

All reactions

Sorry, something went wrong.

Uh oh!

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

vstinner
vstinner reviewed Sep 11, 2026
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.

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

Sorry, something went wrong.

Uh oh!

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

All reactions
@ashm-dev
test(operator): cover methodcaller cyclic GC
076c0cd
@ashm-dev

ashm-dev commented Sep 11, 2026

Copy link
Copy Markdown
Contributor Author

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

All reactions

Sorry, something went wrong.

Uh oh!

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

@ashm-dev
ashm-dev requested a review from vstinner September 12, 2026 18:29
vstinner
vstinner reviewed Sep 13, 2026
View reviewed changes
Comment thread Lib/test/test_operator.py Resolved

Uh oh!

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

Comment thread Misc/NEWS.d/next/Core_and_Builtins/2026-09-13-10-43-24.gh-issue-156762.Kbf2mo.rst Resolved

Uh oh!

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

ashm-dev and others added 2 commits September 13, 2026 10:36
@ashm-dev @vstinner
Update Lib/test/test_operator.py
73d41a9
Co-authored-by: Victor Stinner <[email protected]>
@ashm-dev
chore(news): move methodcaller entry to Core_and_Builtins
50f96fa
@ashm-dev
ashm-dev requested a review from vstinner September 13, 2026 07:45
@vstinner
Merge branch 'main' into issue-156762
d5da6f3
@vstinner

vstinner commented Sep 13, 2026

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.

All reactions

Sorry, something went wrong.

Uh oh!

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

vstinner
vstinner approved these changes Sep 13, 2026
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
@bedevere-app bedevere-app Bot added awaiting merge and removed awaiting core review labels Sep 13, 2026
@vstinner vstinner added needs backport to 3.13 only security fixes needs backport to 3.14 bugs and security fixes needs backport to 3.15 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

Uh oh!

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

@miss-islington-app

miss-islington-app Bot commented Sep 13, 2026

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.
🐍🍒⛏🤖

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 Sep 13, 2026
@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.

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.15 bugs and security fixes label Sep 13, 2026
@miss-islington-app

miss-islington-app Bot commented Sep 13, 2026

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
All reactions

Sorry, something went wrong.

Uh oh!

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

@miss-islington-app miss-islington-app Bot assigned vstinner Sep 13, 2026
@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.

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.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
@miss-islington @ashm-dev @vstinner
[3.14] gh-156762: Fix tp_clear slot signature for operator.methodcall…
cb81ae4
…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]>
johnslavik pushed a commit to johnslavik/cpython that referenced this pull request Sep 14, 2026
@ashm-dev @vstinner @johnslavik
pythongh-156762: Fix tp_clear slot signature for operator.methodcalle…
6f369bb
…r() (python#156769)

Co-authored-by: Victor Stinner <[email protected]>
hugovk pushed a commit that referenced this pull request Sep 15, 2026
@miss-islington @ashm-dev @vstinner
[3.15] gh-156762: Fix tp_clear slot signature for operator.methodcall…
54d12bd
…er() (GH-156769) (#157448)

Co-authored-by: Shamil <[email protected]>
Co-authored-by: Victor Stinner <[email protected]>
@StanFromIreland StanFromIreland removed the needs backport to 3.13 only security fixes label Oct 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@sergey-miryanov sergey-miryanov sergey-miryanov approved these changes
@vstinner vstinner vstinner approved these changes

Uh oh!

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

Assignees

@vstinner vstinner

Labels

None yet

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

@ashm-dev @vstinner @sergey-miryanov @StanFromIreland
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 01402503 — 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.