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
{{ message }}
Repository navigation
False positive when using os.PathLike in an isinstance check. #4681
Since version 0.790 mypy fails with the following error:
domdf@ryzen:~/Python$ mypy mypy_os_pathlike.py
mypy_os_pathlike.py:2: error: Only @runtime_checkable protocols can be used with instance and class checks
Found 1 error in 1 file (checked 1 source file)
To Reproduce
Analyse the above source with mypy 0.790
Expected Behavior
With mypy 0.782 everything was OK:
domdf@ryzen:~/Python$ mypy mypy_os_pathlike.py
Success: no issues found in 1 source file
From what I can tell, os.PathLike is not a Protocol but an abc.ABC, so I'm not sure why mypy thinks it is.
Actual Behavior
mypy thinks os.PathLike is a Protocol that cannot be used in isinstance checks.
Your Environment
Mypy version used: 0.790
Mypy command-line flags: None
Mypy configuration options from mypy.ini (and other config files): None
Activity
JelleZijlstra commentedon Oct 17, 2020
This was fixed recently (#4582), but I think the fix didn't make it into the most recent mypy release yet.