From 8d4b18429de504445a1338077e495090d91044b4 Mon Sep 17 00:00:00 2001 From: Mark Shannon Date: Thu, 6 May 2021 13:38:50 +0100 Subject: Correct location for syntax error in try-except (GH-25939) --- Python/compile.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Python/compile.c') diff --git a/Python/compile.c b/Python/compile.c index 4fc8b38d97..d6bcca1c02 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -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; -- cgit v1.2.1