Improve SyntaxError for invalid type param definition
Open
@sobolevn is already working on this.
Since Oct 11, 2024.
topic-parser
topic-typing
type-feature
- Dominant language
- Python
- Stars
- 77.2k
- Forks
- 35.9k
- PR merge metrics
- PR metrics pending
Description
Feature or enhancement
Current message:
>>> type A[yield] = ...
File "<python-input-0>", line 1
type A[yield] = ...
^^^^^
SyntaxError: invalid syntax
>>> type A[...] = ...
File "<python-input-1>", line 1
type A[...] = ...
^^^
SyntaxError: invalid syntax
>>> type A[1] = ...
File "<python-input-2>", line 1
type A[1] = ...
^
SyntaxError: invalid syntax
Would it make sense to say what can be there?
Something like: expected a type parameter definition, found "%R" % _PyPegen_get_expr_name(expr)
Linked PRs
- gh-125353
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.
Assessment
This issue has not been assessed yet.