-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Fix __post_init__() internal error #16080
Conversation
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.
Maybe add a test?
@@ -515,7 +515,6 @@ def __init__(self) -> None: | |||
# Original, not semantically analyzed type (used for reprocessing) | |||
self.unanalyzed_type: mypy.types.ProperType | None = None | |||
# If method, reference to TypeInfo | |||
# TODO: Type should be Optional[TypeInfo] |
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.
This comment was added in 2018 in #4438.
FakeInfo was added in 2017, and the following comment seems to be at odds:
Lines 3366 to 3370 in fdc7914
# 'None' is not used as a dummy value for two reasons: | |
# 1. This will require around 80-100 asserts to make 'mypy --strict-optional mypy' | |
# pass cleanly. | |
# 2. If NOT_READY value is accidentally used somewhere, it will be obvious where the value | |
# is from, whereas a 'None' value could come from anywhere. |
btw, repro is even simpler 🤦 def __post_init__() -> None:
pass |
This comment has been minimized.
This comment has been minimized.
According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅ |
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.
Thanks!
Fixes #16057.