mirror of
https://github.com/python/cpython.git
synced 2025-08-31 14:07:50 +00:00
Correct location for syntax error in try-except (GH-25939)
This commit is contained in:
parent
60ba0b6847
commit
8d4b18429d
3 changed files with 4 additions and 2 deletions
|
@ -3165,9 +3165,9 @@ compiler_try_except(struct compiler *c, stmt_ty s)
|
|||
for (i = 0; i < n; i++) {
|
||||
excepthandler_ty handler = (excepthandler_ty)asdl_seq_GET(
|
||||
s->v.Try.handlers, i);
|
||||
SET_LOC(c, handler);
|
||||
if (!handler->v.ExceptHandler.type && i < n-1)
|
||||
return compiler_error(c, "default 'except:' must be last");
|
||||
SET_LOC(c, handler);
|
||||
except = compiler_new_block(c);
|
||||
if (except == NULL)
|
||||
return 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue