Skip to content

Conversation

@Gobot1234
Copy link
Contributor

@Gobot1234 Gobot1234 commented Jul 15, 2023

Inspired by microsoft/pyright#5515
Closes #6069

@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 <[email protected]>
@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.

@github-actions

This comment has been minimized.

@srittau
Copy link
Collaborator

srittau commented Feb 19, 2024

Still waiting for python/mypy#15687.

@github-actions

This comment has been minimized.

ilevkivskyi added a commit to python/mypy that referenced this pull request Oct 4, 2025
@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.

@github-actions
Copy link
Contributor

github-actions bot commented Jan 7, 2026

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

@srittau srittau removed the status: deferred Issue or PR deferred until some precondition is fixed label Jan 7, 2026
@srittau
Copy link
Collaborator

srittau commented Jan 7, 2026

I've removed the "deferred" marker.

We might be able to suppress mypy's warnings, although we should add some tests to ensure that mypy still works correctly despite that.

@Gobot1234
Copy link
Contributor Author

I've removed the "deferred" marker.

We might be able to suppress mypy's warnings, although we should add some tests to ensure that mypy still works correctly despite that.

Where do you want these?

@AlexWaygood
Copy link
Member

I've removed the "deferred" marker.
We might be able to suppress mypy's warnings, although we should add some tests to ensure that mypy still works correctly despite that.

Where do you want these?

You could add a check_bool.py file to this directory: https://github.com/python/typeshed/tree/main/stdlib/%40tests/test_cases/builtins. Docs on how those tests work can be found at https://github.com/python/typeshed/blob/main/tests/REGRESSION.md.

Sign up for free to 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.

bool() return type on with no arguments

4 participants