Whether strict mode or not, setting an empty tuple to the generic type alias type argument of `ParamSpec` base gets no error
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 15.6k
- Forks
- 1.8k
- Avg merge
- 12h 13m
- Merged PRs (30d)
- 52
Description
*Memo:
- pyright test.py
- pyright 1.1.407
- Python 3.14.0
- Windows 11
Whether strict mode or not, setting an empty tuple to the generic class and function type argument of ParamSpec base gets the errors, which is proper I think as shown below:
class Cls[**P]: ...
# ↓↓
cls: Cls[()] # Error
error: Too few type arguments provided for "Cls"; expected 1 but received 0
def func[**P]() -> None: ...
# ↓↓
v: func[()] # Error
error: Expected class but received "() -> None"
But whether strict mode or not, setting an empty tuple to the generic type alias type argument of ParamSpec base gets no error, which is improper I think as shown below:
from typing import Callable
type TA[**P] = Callable[P, None]
# ↓↓
v: TA[()] # No error
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the report with test.py and pyright 1.1.407, comparing the diagnostics for Cls[()], func[()] and the ParamSpec-based alias TA[()]. Trace the generic type-alias handling involved in the last case. Done means TA[()] reports the invalid empty type argument consistently in strict and non-strict modes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100