-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Closed
Description
Bug Report
Take, for example. the following code:
import os, pathlib
print(isinstance(pathlib.Path(), os.PathLike))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 - Python version used: Python 3.8
- Operating system and version: Ubuntu 20.04
Metadata
Metadata
Assignees
Labels
No labels