Skip to content

gh-83731: Test that isinstance() ignores tuple subclass methods - #158000

Merged
methane merged 1 commit into
python:mainfrom
vasiliyk:gh-83731-isinstance
Oct 16, 2026
Merged

methane merged 1 commit into
python:mainfrom
vasiliyk:gh-83731-isinstance

Conversation

@vasiliyk

@vasiliyk vasiliyk commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Add a regression test to make sure isinstance() reads the items of a tuple subclass directly, without calling its __iter__(), __getitem__() or __len__().

Following @pganssle suggestion to lock in current behaviour so that a future change to the tuple handling can't start using these methods by accident.

Add a regression test to make sure isinstance() reads the items of a
tuple subclass directly, without calling its __iter__(), __getitem__()
or __len__().
@picnixz picnixz 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 24, 2026
@vasiliyk

Copy link
Copy Markdown
Contributor Author

@methane Thanks for the approval! Is there anything else I can do before this can be merged?

@methane
methane merged commit 21a36aa into python:main Oct 16, 2026
65 checks passed
@miss-islington-app

Copy link
Copy Markdown

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

@miss-islington-app

Copy link
Copy Markdown

Sorry, @vasiliyk and @methane, I could not cleanly backport this to 3.13 due to a conflict.

Please backport manually with cherry_picker, see the devguide for more information.

cherry_picker 21a36aa79ca0b2af49995fa1b9216b01ef98f195 3.13

@bedevere-app

bedevere-app Bot commented Oct 16, 2026

Copy link
Copy Markdown

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

@bedevere-app bedevere-app Bot removed the needs backport to 3.15 bugs and security fixes label Oct 16, 2026
@bedevere-app

bedevere-app Bot commented Oct 16, 2026

Copy link
Copy Markdown

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

@bedevere-app

bedevere-app Bot commented Oct 16, 2026

Copy link
Copy Markdown

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

@bedevere-app bedevere-app Bot removed the needs backport to 3.13 only security fixes label Oct 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip news tests Tests in the Lib/test dir

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants