diff options
author | Pablo Galindo <Pablogsal@gmail.com> | 2021-04-15 23:45:42 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-15 23:45:42 (GMT) |
commit | b5b98bd8f8c72a9068cf149dbc162c8c95d30057 (patch) | |
tree | d5ad6222ee887077367fe44510f946463a0d89e4 /Grammar | |
parent | b280248be8e648feb82f3f3ed0050e50b238df7b (diff) | |
download | cpython-b5b98bd8f8c72a9068cf149dbc162c8c95d30057.zip cpython-b5b98bd8f8c72a9068cf149dbc162c8c95d30057.tar.gz cpython-b5b98bd8f8c72a9068cf149dbc162c8c95d30057.tar.bz2 |
bpo-43823: Fix location of one of the errors for invalid dictionary literals (GH-25427)
Diffstat (limited to 'Grammar')
-rw-r--r-- | Grammar/python.gram | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Grammar/python.gram b/Grammar/python.gram index e5baac3..d91e887 100644 --- a/Grammar/python.gram +++ b/Grammar/python.gram @@ -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 ':'") } |