Skip to content

Move final detection for Enum in checker.py - #11984

Merged
sobolevn merged 6 commits into
python:masterfrom
sobolevn:issue-11850
Jan 18, 2022
Merged

Move final detection for Enum in checker.py#11984
sobolevn merged 6 commits into
python:masterfrom
sobolevn:issue-11850

Conversation

@sobolevn

Copy link
Copy Markdown
Member

Changes:

  • I've moved all final detection logic from semanal.py to checker.py. Why? Because we need type checking! For example, methods, properties, and other descriptors are not counted as Enum membres
  • We don't modify .is_final anymore. Why? It is too disruptive. Now this is a special-case for Enum only

Closes#11850

@JukkaLJukkaL left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks, looks good! It makes sense to do these checks during type checking. Left a few nits; feel to merge when you've addressed them (and fixed the merge conflict).

Comment threadmypy/util.py Outdated
Comment threadtest-data/unit/check-enum.test
@sobolevn

sobolevn commented Jan 18, 2022

Copy link
Copy Markdown
MemberAuthor

Fixed merge conflicts, rebased, waiting for the CI to pass and merging 🎉

@sobolevn

Copy link
Copy Markdown
MemberAuthor

@JukkaL I am going to use these guidelines for merging process: https://github.com/python/mypy/blob/master/CONTRIBUTING.md#core-developer-guidelines

@sobolevn
sobolevn merged commit 0a03ba0 into python:masterJan 18, 2022
@sobolevn

Copy link
Copy Markdown
MemberAuthor

Done! My first merged PR 🎉

@JelleZijlstra

Copy link
Copy Markdown
Member

Congratulations!

tushar-deepsource pushed a commit to DeepSourceCorp/mypy that referenced this pull request Jan 20, 2022
Sign up for freeto 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.

0.930 still gives me "inheriting final" error with an enum.Flag subclass

3 participants

@sobolevn@JelleZijlstra@JukkaL