Skip to content
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

SyntaxError location for *args in class bases is inconsistent #93165

Open
tusharsadhwani opened this issue May 24, 2022 · 1 comment
Open

SyntaxError location for *args in class bases is inconsistent #93165

tusharsadhwani opened this issue May 24, 2022 · 1 comment
Labels
3.10 interpreter-core type-bug

Comments

@tusharsadhwani
Copy link
Contributor

@tusharsadhwani tusharsadhwani commented May 24, 2022

Code snippet:

class C(list[int]): ...

On Python 3.9:

>>> class C(list[*a]): ...
  File "<stdin>", line 1
    class C(list[*a]): ...
                   ^
SyntaxError: invalid syntax
>>> 

On Python 3.10:

>>> class C(list[*a]): ...
  File "<stdin>", line 1
    class C(list[*a]): ...
           ^
SyntaxError: expected ':'
>>>

I'd have expected it to point directly at the * in both cases.

@tusharsadhwani tusharsadhwani added the type-bug label May 24, 2022
@AlexWaygood AlexWaygood added interpreter-core 3.10 labels May 24, 2022
@AlexWaygood
Copy link
Member

@AlexWaygood AlexWaygood commented May 24, 2022

Reproduced on 3.9/3.10 (but not on 3.11, where this isn't a SyntaxError at all due to PEP 646).

Cc. @pablogsal

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.10 interpreter-core type-bug
Projects
None yet
Development

No branches or pull requests

2 participants