summaryrefslogtreecommitdiffstats
path: root/Grammar
diff options
context:
space:
mode:
authorƁukasz Langa <lukasz@langa.pl>2021-08-18 21:03:59 (GMT)
committerGitHub <noreply@github.com>2021-08-18 21:03:59 (GMT)
commit4e4d35d3325fb1e05dad43bd1ec73f14c3c5dc0a (patch)
tree3d83e2890ed67597a888e2ad9aad279ac3c3f74a /Grammar
parentb2779b2aa16acb3fd1297ccfe2fe5aaa007f74ae (diff)
downloadcpython-4e4d35d3325fb1e05dad43bd1ec73f14c3c5dc0a.zip
cpython-4e4d35d3325fb1e05dad43bd1ec73f14c3c5dc0a.tar.gz
cpython-4e4d35d3325fb1e05dad43bd1ec73f14c3c5dc0a.tar.bz2
[3.9] bpo-44947: Refine the syntax error for trailing commas in import statements (GH-27814) (GH-27817)
(cherry picked from commit b2f68b190035540872072ac1d2349e7745e85596) Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
Diffstat (limited to 'Grammar')
-rw-r--r--Grammar/python.gram2
1 files changed, 1 insertions, 1 deletions
diff --git a/Grammar/python.gram b/Grammar/python.gram
index 544b4f7..38405b7 100644
--- a/Grammar/python.gram
+++ b/Grammar/python.gram
@@ -692,5 +692,5 @@ invalid_group:
| '(' a=starred_expression ')' {
RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "can't use starred expression here") }
invalid_import_from_targets:
- | import_from_as_names ',' {
+ | import_from_as_names ',' NEWLINE {
RAISE_SYNTAX_ERROR("trailing comma not allowed without surrounding parentheses") }