Skip to content

gh-157526: Call __instancecheck__ and __subclasscheck__ without creating a bound method - #157670

Merged
kumaraditya303 merged 2 commits into
python:mainfrom
kumaraditya303:isinstance-special-method-call
Sep 22, 2026
Merged

kumaraditya303 merged 2 commits into
python:mainfrom
kumaraditya303:isinstance-special-method-call

Conversation

@kumaraditya303

@kumaraditya303 kumaraditya303 commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

This reduces contention when calling these methods used by ABC on free-threading.

Skipping news for individual PR, will add one after all work is complete.

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

Looks good. There's one issue with the call to _PyObject_LookupSpecialMethod that I think we need to deal with though.

Comment thread Objects/abstract.c Outdated
@bedevere-app

bedevere-app Bot commented Sep 18, 2026

Copy link
Copy Markdown

When you're done making the requested changes, leave the comment: I have made the requested changes; please review again.

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

LGTM!

@kumaraditya303
kumaraditya303 merged commit d4f52c4 into python:main Sep 22, 2026
79 of 80 checks passed
@kumaraditya303
kumaraditya303 deleted the isinstance-special-method-call branch September 22, 2026 05:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants