-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Closed
Description
$ python --version
Python 3.8.0
$ mypy --version
mypy 0.790
$ cat t.py
from subprocess import Popen, PIPE
def foo(popen: Popen) -> None:
pass
foo(Popen(["ls"], stdout=PIPE))
$ mypy --strict --python-version 3.8 t.py
t.py:3: error: Missing type parameters for generic type "Popen"
Found 1 error in 1 file (checked 1 source file)
$ sed -i -e 's/popen: Popen/popen: Popen[bytes]/' t.py
$ mypy --strict --python-version 3.8 t.py
Success: no issues found in 1 source file
$ python3.8 t.py
Traceback (most recent call last):
File "t.py", line 3, in <module>
def foo(popen: Popen[bytes]) -> None:
TypeError: 'type' object is not subscriptable
Following mypy's (run with python 3.8, in python version 3.8 mode) advise and adding type parameter for it makes the result actually not run with python 3.8 any more (with 3.9 it would be fine). I see Popen is marked generic in typeshed for all 3.x versions, and suppose that's the root cause for the issue; shouldn't it be marked as such only for >= 3.9?
Metadata
Metadata
Assignees
Labels
No labels