diff options
author | Neal Norwitz <nnorwitz@gmail.com> | 2008-03-31 05:14:30 (GMT) |
---|---|---|
committer | Neal Norwitz <nnorwitz@gmail.com> | 2008-03-31 05:14:30 (GMT) |
commit | ad74aa8dc015fab019ffa965f45cc3437ad152c2 (patch) | |
tree | 2e4c8aad0da2d1d65be842895efc52af6d8adc64 /Python/compile.c | |
parent | d35759388b224106c4331812d5931d8ce5ae8c07 (diff) | |
download | cpython-ad74aa8dc015fab019ffa965f45cc3437ad152c2.zip cpython-ad74aa8dc015fab019ffa965f45cc3437ad152c2.tar.gz cpython-ad74aa8dc015fab019ffa965f45cc3437ad152c2.tar.bz2 |
Merged revisions 62047 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r62047 | georg.brandl | 2008-03-29 23:40:17 -0700 (Sat, 29 Mar 2008) | 2 lines
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 | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/Python/compile.c b/Python/compile.c index ab51c7b..9ce8ac3 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -1984,22 +1984,22 @@ 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 = 0; 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) { + if (handler->v.ExceptHandler.name) { basicblock *cleanup_end, *cleanup_body; cleanup_end = compiler_new_block(c); @@ -2007,7 +2007,7 @@ compiler_try_except(struct compiler *c, stmt_ty s) if(!(cleanup_end || cleanup_body)) return 0; - compiler_nameop(c, handler->name, Store); + compiler_nameop(c, handler->v.ExceptHandler.name, Store); ADDOP(c, POP_TOP); /* @@ -2028,7 +2028,7 @@ compiler_try_except(struct compiler *c, stmt_ty s) return 0; /* second # body */ - VISIT_SEQ(c, stmt, handler->body); + VISIT_SEQ(c, stmt, handler->v.ExceptHandler.body); ADDOP(c, POP_BLOCK); compiler_pop_fblock(c, FINALLY_TRY, cleanup_body); @@ -2040,10 +2040,10 @@ compiler_try_except(struct compiler *c, stmt_ty s) /* name = None */ ADDOP_O(c, LOAD_CONST, Py_None, consts); - compiler_nameop(c, handler->name, Store); + compiler_nameop(c, handler->v.ExceptHandler.name, Store); /* del name */ - compiler_nameop(c, handler->name, Del); + compiler_nameop(c, handler->v.ExceptHandler.name, Del); ADDOP(c, END_FINALLY); compiler_pop_fblock(c, FINALLY_END, cleanup_end); @@ -2051,11 +2051,11 @@ compiler_try_except(struct compiler *c, stmt_ty s) 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); |