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
At runtime, comparing an instance of Path to str seems to be always negative, i.e., they don't overlap in terms of comparison.
Using the --strict-equality typically errors in such cases that are non-overlapping and cannot possibly yield True. This mechanism doesn't seem to work for Path and str, allowing to silently let such bugs pass.
To Reproduce
The following code has a bug, because the Path to str does not work as intended
frompathlibimportPatha="/foo"b=Path("/foo")
ifa==b: # can never be true
...
Expected Behavior
I'd have expected a type error similar to the one for comparing e.g. str to int:
Bug Report
At runtime, comparing an instance of
Path
tostr
seems to be always negative, i.e., they don't overlap in terms of comparison.Using the
--strict-equality
typically errors in such cases that are non-overlapping and cannot possibly yieldTrue
. This mechanism doesn't seem to work forPath
andstr
, allowing to silently let such bugs pass.To Reproduce
The following code has a bug, because the
Path
tostr
does not work as intendedExpected Behavior
I'd have expected a type error similar to the one for comparing e.g.
str
toint
:Actual Behavior
--strict-equality
has no effect here, and misses the bug.Your Environment
--strict-equality
mypy.ini
(and other config files): -The text was updated successfully, but these errors were encountered: