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

Make enum attributes implicitly final #5599

Closed
ilevkivskyi opened this issue Sep 11, 2018 · 0 comments · Fixed by #10852
Closed

Make enum attributes implicitly final #5599

ilevkivskyi opened this issue Sep 11, 2018 · 0 comments · Fixed by #10852
Labels

Comments

@ilevkivskyi
Copy link
Member

This is currently allowed but fails at runtime:

from enum import Enum

class Other(Enum):
    test = 1

Other.test = 2

but it fails at runtime.

This is a follow-up for #5522

@ilevkivskyi ilevkivskyi added bug mypy got something wrong priority-1-normal labels Sep 11, 2018
97littleleaf11 pushed a commit that referenced this issue Nov 10, 2021
refs #5599

This change allows to catch this error by making all Enum members 
implicitly Final.

Also modifies Enum plugin, since it was not ready to work 
with `Literal[True]` and `Literal[False]`.

Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
tushar-deepsource pushed a commit to DeepSourceCorp/mypy that referenced this issue Jan 20, 2022
refs python#5599

This change allows to catch this error by making all Enum members 
implicitly Final.

Also modifies Enum plugin, since it was not ready to work 
with `Literal[True]` and `Literal[False]`.

Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants