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

Mark enum constants in signal.py as Final, not Literal #13500

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

sobolevn
Copy link
Member

PR #13336 caused a regression in mypy, see python/mypy#18628

So, I changed Literal to Final, since it works and added a test case for the regression.

This comment has been minimized.

@AlexWaygood
Copy link
Member

The change basically LGTM, but pytype is crashing. Also, pyright has quite different inference for generic parameters compared to mypy, so I think we'll struggle to find a test case test demonstrates the issue clearly while passing on both mypy and pyright. I'd be tempted to just skip the test case, personally.

Copy link
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

@sobolevn
Copy link
Member Author

Any ideas on what's wrong?

stdlib/signal.pyi (3.12): pytype.pytd.visitors.LiteralValueError: In Literal[SIG_DFL]: builtins.int is not an enum and cannot be used in typing.Literal

@AlexWaygood
Copy link
Member

looks like a pytype bug to me

@sobolevn
Copy link
Member Author

cc @rchen152

@AlexWaygood
Copy link
Member

cc @rchen152

I don't think Rebecca works on pytype anymore :-) maybe @frigus02 could take a look?

@frigus02
Copy link
Contributor

I don't work on pytype anymore, either. Maybe @h-joo?

@AlexWaygood
Copy link
Member

I don't work on pytype anymore, either.

Oh, sorry!

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.

3 participants