diff options
author | Georg Brandl <georg@python.org> | 2008-03-30 06:40:17 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2008-03-30 06:40:17 (GMT) |
commit | a48f3ab8951fa97844f2a4fa368483af968b7b73 (patch) | |
tree | 59349d2cbbcb23204391adcd8c1a37896d2ab16e /Python/compile.c | |
parent | c15317efcd21015a2e076eb0413043c74d84056f (diff) | |
download | cpython-a48f3ab8951fa97844f2a4fa368483af968b7b73.zip cpython-a48f3ab8951fa97844f2a4fa368483af968b7b73.tar.gz cpython-a48f3ab8951fa97844f2a4fa368483af968b7b73.tar.bz2 |
Patch #2511: Give the "excepthandler" AST item proper attributes by making it a Sum.
Diffstat (limited to 'Python/compile.c')
-rw-r--r-- | Python/compile.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/Python/compile.c b/Python/compile.c index ae1f0da..c81218d 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -1855,32 +1855,32 @@ 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.TryExcept.handlers, i); - if (!handler->type && i < n-1) + if (!handler->v.ExceptHandler.type && i < n-1) return compiler_error(c, "default 'except:' must be last"); c->u->u_lineno_set = false; c->u->u_lineno = handler->lineno; except = compiler_new_block(c); if (except == NULL) return 0; - if (handler->type) { + if (handler->v.ExceptHandler.type) { ADDOP(c, DUP_TOP); - VISIT(c, expr, handler->type); + VISIT(c, expr, handler->v.ExceptHandler.type); ADDOP_I(c, COMPARE_OP, PyCmp_EXC_MATCH); ADDOP_JREL(c, JUMP_IF_FALSE, except); ADDOP(c, POP_TOP); } ADDOP(c, POP_TOP); - if (handler->name) { - VISIT(c, expr, handler->name); + if (handler->v.ExceptHandler.name) { + VISIT(c, expr, handler->v.ExceptHandler.name); } else { ADDOP(c, POP_TOP); } ADDOP(c, POP_TOP); - VISIT_SEQ(c, stmt, handler->body); + VISIT_SEQ(c, stmt, handler->v.ExceptHandler.body); ADDOP_JREL(c, JUMP_FORWARD, end); compiler_use_next_block(c, except); - if (handler->type) + if (handler->v.ExceptHandler.type) ADDOP(c, POP_TOP); } ADDOP(c, END_FINALLY); |