-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Use __new__ instead of __init__ for some builtin classes #4555
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
Conversation
This reverts commit 8e1ddd5.
@hauntsaninja There is something strange going on with the mro here, see the comment in the stubtest whitelist. In my opinion, this special case (quirk in Python?) should be handled by stubtest (or mypy?), instead of putting the enums on the whitelist. What do you think? An alternative is to override |
I'm guessing that the Enum metaclass plunks a reference to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh interesting. I'd probably agree that this should be handled by stubtest / mypy.
|
I was a little worried about this PR, so I ran mypy_primer:
Seems fine! |
Closes #4514 #2630 #2686
I tested this against our internal codebases and against the example in #1464 and it seems to works fine.