mirror of
https://github.com/python/cpython.git
synced 2025-08-03 00:23:06 +00:00
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
This commit is contained in:
parent
aedb5194d5
commit
8c237a7a71
4 changed files with 525 additions and 449 deletions
|
@ -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 ':'") }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue