mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
bpo-40334: Reproduce error message for type comments on bare '*' in the new parser (GH-20151)
This commit is contained in:
parent
d71a6492db
commit
75b863aa97
5 changed files with 55 additions and 23 deletions
|
@ -178,6 +178,16 @@ SyntaxError: invalid syntax
|
|||
Traceback (most recent call last):
|
||||
SyntaxError: invalid syntax
|
||||
|
||||
>>> import ast; ast.parse('''
|
||||
... def f(
|
||||
... *, # type: int
|
||||
... a, # type: int
|
||||
... ):
|
||||
... pass
|
||||
... ''', type_comments=True)
|
||||
Traceback (most recent call last):
|
||||
SyntaxError: bare * has associated type comment
|
||||
|
||||
|
||||
From ast_for_funcdef():
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue