summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorMark Shannon <mark@hotpy.org>2021-05-06 12:38:50 (GMT)
committerGitHub <noreply@github.com>2021-05-06 12:38:50 (GMT)
commit8d4b18429de504445a1338077e495090d91044b4 (patch)
tree10ce565ceed11df95a29bbfa4299e187d2e07f61 /Python
parent60ba0b68470a584103e28958d91e93a6db37ec92 (diff)
downloadcpython-8d4b18429de504445a1338077e495090d91044b4.zip
cpython-8d4b18429de504445a1338077e495090d91044b4.tar.gz
cpython-8d4b18429de504445a1338077e495090d91044b4.tar.bz2
Correct location for syntax error in try-except (GH-25939)
Diffstat (limited to 'Python')
-rw-r--r--Python/compile.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/Python/compile.c b/Python/compile.c
index 4fc8b38..d6bcca1 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;