Skip to content

Improve SyntaxError for invalid type param definition #125326

Open
@sobolevn

Description

@sobolevn

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

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions