mirror of
https://github.com/python/cpython.git
synced 2025-11-01 18:51:43 +00:00
bpo-43823: Fix location of one of the errors for invalid dictionary literals (GH-25427)
This commit is contained in:
parent
b280248be8
commit
b5b98bd8f8
2 changed files with 3 additions and 2 deletions
|
|
@ -899,6 +899,7 @@ invalid_double_starred_kvpairs:
|
|||
| expression ':' a='*' bitwise_or { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "cannot use a starred expression in a dictionary value") }
|
||||
| expression a=':' &('}'|',') { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "expression expected after dictionary key and ':'") }
|
||||
invalid_kvpair:
|
||||
| a=expression !(':') { RAISE_SYNTAX_ERROR("':' expected after dictionary key") }
|
||||
| a=expression !(':') {
|
||||
RAISE_ERROR_KNOWN_LOCATION(p, PyExc_SyntaxError, a->lineno, a->end_col_offset - 1, "':' expected after dictionary key") }
|
||||
| expression ':' a='*' bitwise_or { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "cannot use a starred expression in a dictionary value") }
|
||||
| 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