You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Mypy seems to treat int as a subtype of float even though python doesn't think so and in some cases they are not interchangeable. We hit this multiple times: with FFI, using some strict runtime type assertions, and comparing json output of "equal" inputs where the inputs differed in float-ness and therefore the strings ended up having .0 only some of the time.
While I understand why, in some less-strict codebases this may be desireable, it would be good to at least be able to opt out of this.
Bug Report
Mypy seems to treat
int
as a subtype offloat
even though python doesn't think so and in some cases they are not interchangeable. We hit this multiple times: with FFI, using some strict runtime type assertions, and comparing json output of "equal" inputs where the inputs differed in float-ness and therefore the strings ended up having.0
only some of the time.While I understand why, in some less-strict codebases this may be desireable, it would be good to at least be able to opt out of this.
To Reproduce
Expected Behavior
mypy
rejects the call tofoo
in the exampleActual Behavior
mypy
accepts the call tofoo
in the example, but the program fails at runtime.Your Environment
mypy example.py
mypy.ini
(and other config files):The text was updated successfully, but these errors were encountered: