diff options
author | Irit Katriel <1055913+iritkatriel@users.noreply.github.com> | 2022-11-07 09:41:20 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-07 09:41:20 (GMT) |
commit | d8a42bcaf0c614b48e1956cf27e18b9a9b5d4b6b (patch) | |
tree | 3ba11d1ce6308fd2817d50bf32c2f8fa1ebef9e7 /Parser/parser.c | |
parent | 263e9830aafcea1b0bea60478360604a0d5e04da (diff) | |
download | cpython-d8a42bcaf0c614b48e1956cf27e18b9a9b5d4b6b.zip cpython-d8a42bcaf0c614b48e1956cf27e18b9a9b5d4b6b.tar.gz cpython-d8a42bcaf0c614b48e1956cf27e18b9a9b5d4b6b.tar.bz2 |
[3.11] gh-99153: set location on SyntaxError for try with both except and except* (GH-99160) (#99168)
Diffstat (limited to 'Parser/parser.c')
-rw-r--r-- | Parser/parser.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Parser/parser.c b/Parser/parser.c index 3fc12e5..91fdfb1 100644 --- a/Parser/parser.c +++ b/Parser/parser.c @@ -21892,13 +21892,13 @@ invalid_try_stmt_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> invalid_try_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'try' ':' block* ((except_block+ except_star_block) | (except_star_block+ except_block)) block*")); - Token * _keyword; Token * _literal; asdl_seq * _loop0_203_var; asdl_seq * _loop0_205_var; void *_tmp_204_var; + Token * a; if ( - (_keyword = _PyPegen_expect_token(p, 618)) // token='try' + (a = _PyPegen_expect_token(p, 618)) // token='try' && (_literal = _PyPegen_expect_token(p, 11)) // token=':' && @@ -21910,7 +21910,7 @@ invalid_try_stmt_rule(Parser *p) ) { D(fprintf(stderr, "%*c+ invalid_try_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'try' ':' block* ((except_block+ except_star_block) | (except_star_block+ except_block)) block*")); - _res = RAISE_SYNTAX_ERROR ( "cannot have both 'except' and 'except*' on the same 'try'" ); + _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "cannot have both 'except' and 'except*' on the same 'try'" ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; p->level--; |