bpo-40334: Reproduce error message for type comments on bare '*' in the new parser (GH-20151)

This commit is contained in:
Lysandros Nikolaou 2020-05-18 22:14:47 +03:00 committed by GitHub
parent d71a6492db
commit 75b863aa97
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 55 additions and 23 deletions

View file

@ -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():