Skip to content

Conversation

p-sawicki
Copy link
Collaborator

When comparing tuples, their lengths are now compared and their contents are only compared if their lengths are equal. Otherwise, when they have different lengths, the comparison always evaluates to False.

@brianschubert
Copy link
Member

Good find! I can confirm that this is a bug; (1,) == (1, 2) is True and (1, 2) == (1,) crashes on master.

@brianschubert brianschubert added the topic-mypyc mypyc bugs label Jul 3, 2025
Copy link
Collaborator

@JukkaL JukkaL left a comment

Choose a reason for hiding this comment

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

Thanks, looks good!

@JukkaL JukkaL merged commit 1a99ce2 into python:master Jul 4, 2025
13 checks passed
@p-sawicki p-sawicki deleted the p-sawicki/tuple-comparison branch July 4, 2025 10:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic-mypyc mypyc bugs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants