summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorLysandros Nikolaou <lisandrosnik@gmail.com>2020-05-18 19:14:47 (GMT)
committerGitHub <noreply@github.com>2020-05-18 19:14:47 (GMT)
commit75b863aa97016c6813709eb620c43295f84dd51f (patch)
tree42e29d58a8f325cbbd43bb910837ae1cb8ca0666 /Lib
parentd71a6492dbd5434dfa6a0ad95e3ad98aa690887a (diff)
downloadcpython-75b863aa97016c6813709eb620c43295f84dd51f.zip
cpython-75b863aa97016c6813709eb620c43295f84dd51f.tar.gz
cpython-75b863aa97016c6813709eb620c43295f84dd51f.tar.bz2
bpo-40334: Reproduce error message for type comments on bare '*' in the new parser (GH-20151)
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_syntax.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/test/test_syntax.py b/Lib/test/test_syntax.py
index 87ceced..a82b444 100644
--- a/Lib/test/test_syntax.py
+++ b/Lib/test/test_syntax.py
@@ -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():