summaryrefslogtreecommitdiffstats
path: root/Grammar
diff options
context:
space:
mode:
authorwookie184 <wookie1840@gmail.com>2022-06-26 18:42:47 (GMT)
committerGitHub <noreply@github.com>2022-06-26 18:42:47 (GMT)
commit8c237a7a71d52f996f58dc58f6b6ce558d209494 (patch)
treed74691207859aa85f98e6580d8db2417ec1e7e05 /Grammar
parentaedb5194d590692918a8a070cbde2727fe178f49 (diff)
downloadcpython-8c237a7a71d52f996f58dc58f6b6ce558d209494.zip
cpython-8c237a7a71d52f996f58dc58f6b6ce558d209494.tar.gz
cpython-8c237a7a71d52f996f58dc58f6b6ce558d209494.tar.bz2
gh-94192: Fix error for dictionary literals with invalid expression as value. (#94304)
* Fix error for dictionary literals with invalid expression as value. * Remove trailing whitespace
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 9fd498c..91d73a9 100644
--- a/Grammar/python.gram
+++ b/Grammar/python.gram
@@ -1314,4 +1314,4 @@ invalid_kvpair:
| a=expression !(':') {
RAISE_ERROR_KNOWN_LOCATION(p, PyExc_SyntaxError, a->lineno, a->end_col_offset - 1, a->end_lineno, -1, "':' expected after dictionary key") }
| expression ':' a='*' bitwise_or { RAISE_SYNTAX_ERROR_STARTING_FROM(a, "cannot use a starred expression in a dictionary value") }
- | expression a=':' {RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "expression expected after dictionary key and ':'") }
+ | expression a=':' &('}'|',') {RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "expression expected after dictionary key and ':'") }