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

Closed
tusharsadhwani opened this issue May 24, 2022 · 3 comments
Closed

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

tusharsadhwani opened this issue May 24, 2022 · 3 comments
Labels
3.10 only security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs) type-bug An unexpected behavior, bug, or error

Comments

@tusharsadhwani
Copy link
Contributor

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 An unexpected behavior, bug, or error label May 24, 2022
@AlexWaygood AlexWaygood added interpreter-core (Objects, Python, Grammar, and Parser dirs) 3.10 only security fixes labels May 24, 2022
@AlexWaygood
Copy link
Member

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

@wookie184
Copy link
Contributor

I believe this is a specific case of #92858, which is fixed by #92894

@tusharsadhwani
Copy link
Contributor Author

Correct, closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.10 only security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs) type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

3 participants