summaryrefslogtreecommitdiffstats
path: root/Grammar
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2021-08-18 20:32:01 (GMT)
committerGitHub <noreply@github.com>2021-08-18 20:32:01 (GMT)
commit846a10fc45ef83b41d1b1b568a9ee8012f37c8c2 (patch)
treebe89748501548ee29a1db86ae0e835ee185bb29f /Grammar
parentd1c0e4413dd544270df1f5b8a145fd4370cb759b (diff)
downloadcpython-846a10fc45ef83b41d1b1b568a9ee8012f37c8c2.zip
cpython-846a10fc45ef83b41d1b1b568a9ee8012f37c8c2.tar.gz
cpython-846a10fc45ef83b41d1b1b568a9ee8012f37c8c2.tar.bz2
bpo-44947: Refine the syntax error for trailing commas in import statements (GH-27814)
(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 decc578..b3ae906 100644
--- a/Grammar/python.gram
+++ b/Grammar/python.gram
@@ -947,7 +947,7 @@ invalid_group:
| '(' a='**' expression ')' {
RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "cannot use double 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") }
invalid_with_stmt: