Skip to content

Improve SyntaxError for invalid type param definition #125326

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
sobolevn opened this issue Oct 11, 2024 · 0 comments
Open

Improve SyntaxError for invalid type param definition #125326

sobolevn opened this issue Oct 11, 2024 · 0 comments
Assignees
Labels
topic-parser topic-typing type-feature A feature request or enhancement

Comments

@sobolevn
Copy link
Member

sobolevn commented Oct 11, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic-parser topic-typing type-feature A feature request or enhancement
Projects
None yet
Development

No branches or pull requests

1 participant