Skip to content

gh-159580: Improve performance of isinstance() for misses and improve documentation - #159581

Merged
kumaraditya303 merged 5 commits into
python:mainfrom
eendebakpt:isinstance-class-fastpath
Nov 20, 2026
Merged

kumaraditya303 merged 5 commits into
python:mainfrom
eendebakpt:isinstance-class-fastpath

Conversation

@eendebakpt

@eendebakpt eendebakpt commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Improve performance of instance in the case of misses by avoiding attribute lookup on __class__. Documentation of isinstance is updated to match the actual behavior.

Details and benchmarks in the corresponding issue.

@read-the-docs-community

read-the-docs-community Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

Documentation build overview

📚 cpython-previews | 🛠️ Build #35348044 | 📁 Comparing 25aa834 against main (75ce53d)

  🔍 Preview build  

73 files changed · + 1 added · ± 72 modified

+ Added

± Modified

Comment thread Objects/abstract.c Resolved
eendebakpt and others added 2 commits October 23, 2026 10:16
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@kumaraditya303
kumaraditya303 enabled auto-merge (squash) November 20, 2026 10:56
@kumaraditya303
kumaraditya303 merged commit 8dbf4cf into python:main Nov 20, 2026
59 of 60 checks passed
@StanFromIreland

Copy link
Copy Markdown
Member

Looks like a few benchmarks have moved (in the right direction ;-) with this patch: https://speed.python.org/changes/?rev=ab5b8f87a70b62a22c1ed78b3e26ccd9ba84caaa&exe=12&env=1 (I haven’t confirmed it’s specifically because of this change, but it seems likely.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type-feature A feature request or enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants