New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bpo-45679: Fix caching of multi-value typing.Literal #29334
bpo-45679: Fix caching of multi-value typing.Literal #29334
Conversation
Literal[True, 2] is no longer equal to Literal[1, 2].
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. Thanks Serhiy.
| typing.Literal[1, 2]: 'Literal', | ||
| typing.Literal[True, 2]: 'Literal', |
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.
Not sure if these tests for anything useful? It should still pass even without the fix.
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.
Ah, it passes without the fix because due to the bug typing.Literal[True, 2] and typing.Literal[1, 2] are the same.
But it fails with the PR originally proposed by @sobolevn. Some tests are added to catch possible similar errors.
|
Thanks @serhiy-storchaka for the PR |
Literal[True, 2] is no longer equal to Literal[1, 2]. (cherry picked from commit 634984d) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
|
Sorry, @serhiy-storchaka, I could not cleanly backport this to |
|
GH-29340 is a backport of this pull request to the 3.10 branch. |
|
GH-29342 is a backport of this pull request to the 3.9 branch. |
Literal[True, 2] is no longer equal to Literal[1, 2].
https://bugs.python.org/issue45679