Closed as not planned
Closed as not planned

Description
Bug Report
try-except imported ParamSpec is unusable.
try:
from typing import ParamSpec
except ImportError:
from typing_extensions import ParamSpec
This makes ParamSpec("P")
become an invaild type.
To Reproduce
from typing import Callable
try:
from typing import ParamSpec # type: ignore[attr-defined,unused-ignore]
except ImportError:
from typing_extensions import ParamSpec # type: ignore[import,unused-ignore]
P = ParamSpec("P")
def func(arg: Callable[P, None]) -> None:
return None
Expected Behavior
No error
Actual Behavior
error: The first argument to Callable must be a list of types, parameter specification, or "..." [valid-type]
Your Environment
- OS:
Ubuntu 22.04.3 LTS (GNU/Linux 5.15.0-94-generic x86_64)
- Mypy version used:
1.8.0 (compiled: yes)
- Mypy command-line flags: None
- Mypy configuration options from
mypy.ini
(and other config files): None - Python version used:
3.8.18