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

Special cases Enum and some special props to be non-final, refs #11699 #11713

Merged
merged 2 commits into from
Dec 13, 2021
Merged

Special cases Enum and some special props to be non-final, refs #11699 #11713

merged 2 commits into from
Dec 13, 2021

Conversation

sobolevn
Copy link
Member

My naive attempt to fix bug with some special Enum props which are treated as Final.
I just special case it and ignore them.

This looks like the simplest solution. And it fits Enum pretty well, because Enum is special in how class / instances are treated.

Closes #11699

@github-actions

This comment has been minimized.

@github-actions
Copy link
Contributor

Diff from mypy_primer, showing the effect of this PR on open source code:

prefect (https://github.com/PrefectHQ/prefect)
- src/prefect/core/task.py:45: error: Cannot override writable attribute "value" with a final one

alerta (https://github.com/alerta/alerta)
- alerta/models/enums.py:159: error: Cannot override writable attribute "value" with a final one

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! It looks like _name_ and _value_ are not accepted at runtime, even without overriding, but this is minor.

@JukkaL JukkaL merged commit 1970029 into python:master Dec 13, 2021
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.

Defining _order_ in an enum class rejected
3 participants