-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
Open
Labels
Description
Bug report
Bug description:
*Memo:
- mypy test.py
- pyright test.py
- mypy 1.19.1
- pyright 1.1.407
- Python 3.13.11
- Windows 11
The docstring of ParamSpec shows two examples as shown below:
from typing import ParamSpec
print(help(ParamSpec))type IntFuncDefault[**P = (int, str)] = Callable[P, int]
P = ParamSpec('P')
DefaultP = ParamSpec('DefaultP', default=(int, str))
But mypy gives the error because a tuple is set instead of a list as shown below:
*Memo:
- pyright also gives error.
from typing import ParamSpec
# ↓ tuple ↓
type IntFuncDefault[**P = (int, str)] = Callable[P, int] # Error
P = ParamSpec('P') # ↓ tuple ↓
DefaultP = ParamSpec('DefaultP', default=(int, str)) # Errorerror: The default argument to ParamSpec must be a list expression, ellipsis, or a ParamSpec
Actually, setting a list gets no error as shown below:
from typing import ParamSpec
# ↓ list ↓
type IntFuncDefault[**P = [int, str]] = Callable[P, int] # No error
P = ParamSpec('P') # ↓ list ↓
DefaultP = ParamSpec('DefaultP', default=[int, str]) # No errorSo, the docstring of ParamSpec should show two examples with a list instead of a tuple as shown below:
type IntFuncDefault[**P = [int, str]] = Callable[P, int]
P = ParamSpec('P')
DefaultP = ParamSpec('DefaultP', default=[int, str])
CPython versions tested on:
3.13
Operating systems tested on:
Windows