-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Overload bool.__new__ for Literal bools #10465
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
base: main
Are you sure you want to change the base?
Conversation
This comment has been minimized.
This comment has been minimized.
Is there a way to see the projects this affects using mypy-primer using my mypy branch? |
The easiest way would be to temporarily push a commit to your mypy PR that makes these edits to |
This comment has been minimized.
This comment has been minimized.
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
python/mypy#15687 (comment) changes don't appear to be causing any problems |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Still waiting for python/mypy#15687. |
Diff from mypy_primer, showing the effect of this PR on open source code: colour (https://github.com/colour-science/colour)
+ colour/continuous/signal.py:835: error: Argument 1 to "bool" has incompatible type "numpy.bool[builtins.bool]"; expected "_Truthy" [arg-type]
+ colour/continuous/signal.py:835: note: Following member(s) of "numpy.bool[builtins.bool]" have conflicts:
+ colour/continuous/signal.py:835: note: Expected:
+ colour/continuous/signal.py:835: note: def __bool__(self) -> Literal[True]
+ colour/continuous/signal.py:835: note: Got:
+ colour/continuous/signal.py:835: note: def __bool__(self) -> bool
+ colour/colorimetry/spectrum.py:415: error: Argument 1 to "bool" has incompatible type "numpy.bool[builtins.bool]"; expected "_Truthy" [arg-type]
+ colour/colorimetry/spectrum.py:415: note: Following member(s) of "numpy.bool[builtins.bool]" have conflicts:
+ colour/colorimetry/spectrum.py:415: note: Expected:
+ colour/colorimetry/spectrum.py:415: note: def __bool__(self) -> Literal[True]
+ colour/colorimetry/spectrum.py:415: note: Got:
+ colour/colorimetry/spectrum.py:415: note: def __bool__(self) -> bool
|
Unblocks python/typeshed#10465 --------- Co-authored-by: Ivan Levkivskyi <levkivskyi@gmail.com>
Is there a way to run this with mypy dev? @srittau |
@Gobot1234 You could just temporarily change the mypy version in |
Inspired by microsoft/pyright#5515
Closes #6069
Deferred because of: python/mypy#15687