summaryrefslogtreecommitdiffstats
path: root/Grammar/python.gram
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2022-06-26 19:07:02 (GMT)
committerGitHub <noreply@github.com>2022-06-26 19:07:02 (GMT)
commit442dd8ffa557018d76adea3058e49cfe8849f851 (patch)
treeb954dd40f018ede23f91f91b4299b79c94758da7 /Grammar/python.gram
parent1b27ec5ac62606b6b5da34dfb794d5975949f864 (diff)
downloadcpython-442dd8ffa557018d76adea3058e49cfe8849f851.zip
cpython-442dd8ffa557018d76adea3058e49cfe8849f851.tar.gz
cpython-442dd8ffa557018d76adea3058e49cfe8849f851.tar.bz2
gh-94192: Fix error for dictionary literals with invalid expression as value. (GH-94304)
* Fix error for dictionary literals with invalid expression as value. * Remove trailing whitespace (cherry picked from commit 8c237a7a71d52f996f58dc58f6b6ce558d209494) Co-authored-by: wookie184 <wookie1840@gmail.com>
Diffstat (limited to 'Grammar/python.gram')
-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 ':'") }