Skip to content

Conversation

Gobot1234
Copy link
Contributor

@Gobot1234 Gobot1234 commented Jul 15, 2023

Inspired by microsoft/pyright#5515
Closes #6069


Deferred because of: python/mypy#15687

@github-actions

This comment has been minimized.

Gobot1234 added a commit to Gobot1234/mypy that referenced this pull request Jul 15, 2023
@srittau srittau added the status: deferred Issue or PR deferred until some precondition is fixed label Jul 17, 2023
@Gobot1234 Gobot1234 changed the title Overload bool.__new__ for Literals Overload __new__ for Literals Jul 19, 2023
@Gobot1234
Copy link
Contributor Author

Is there a way to see the projects this affects using mypy-primer using my mypy branch?

@AlexWaygood
Copy link
Member

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 mypy/typeshed/stdlib/builtins.pyi

@github-actions

This comment has been minimized.

@Gobot1234 Gobot1234 changed the title Overload __new__ for Literals Overload bool.__new__ for Literal bools Jul 19, 2023
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
@Gobot1234
Copy link
Contributor Author

python/mypy#15687 (comment) changes don't appear to be causing any problems

@github-actions

This comment has been minimized.

This comment has been minimized.

@srittau
Copy link
Collaborator

srittau commented Feb 19, 2024

Still waiting for python/mypy#15687.

Copy link
Contributor

github-actions bot commented Oct 3, 2025

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

ilevkivskyi added a commit to python/mypy that referenced this pull request Oct 4, 2025
Unblocks python/typeshed#10465

---------

Co-authored-by: Ivan Levkivskyi <levkivskyi@gmail.com>
@Gobot1234
Copy link
Contributor Author

Is there a way to run this with mypy dev? @srittau

@srittau
Copy link
Collaborator

srittau commented Oct 7, 2025

@Gobot1234 You could just temporarily change the mypy version in requirements-tests.txt to point to a git reference in this PR I think we did this before, but couldn't find it in git log.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: deferred Issue or PR deferred until some precondition is fixed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bool() return type on with no arguments
4 participants