Skip to content
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

Fix various things with Literal #145

Merged
merged 4 commits into from
Apr 17, 2023
Merged

Conversation

AlexWaygood
Copy link
Member

Fixes #113. Closes #144.

Backports python/cpython#23294 and python/cpython#23383, both originally by Yurii Karabas.

A side effect of one of the changes is that equality comparisons of `Literal`
objects will now raise a `TypeError` if one of the `Literal` objects being
compared has a mutable parameter. (Using mutable parameters with `Literal` is
not supported by PEP 586 or by any major static type checkers.)
Copy link
Member

Choose a reason for hiding this comment

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

Nice dig against pyanalyze :)

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh entirely unintentional!! I can take this out if you like :)

Copy link
Member

Choose a reason for hiding this comment

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

Nah, it's true.

@JelleZijlstra
Copy link
Member

Seems like something's broken on 3.9.0.

@AlexWaygood
Copy link
Member Author

Seems like something's broken on 3.9.0.

A result of python/cpython#19620. I'm looking at it.

@JelleZijlstra JelleZijlstra merged commit 8bff0a3 into python:main Apr 17, 2023
15 checks passed
@AlexWaygood AlexWaygood deleted the literal-fixes branch April 17, 2023 18:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

(🐞) Literal doesn't flatten it's arguments
2 participants