summaryrefslogtreecommitdiff
path: root/Python/compile.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2007-01-10 18:51:35 +0000
committerGuido van Rossum <guido@python.org>2007-01-10 18:51:35 +0000
commitd713b9ecac094a8d70877e51c3a2852553c6f284 (patch)
treeb9880bd1370d220394eb4070cb9921480af1a513 /Python/compile.c
parentf16bc2a26e204536d477cddceaeeb5d6d9657c9e (diff)
downloadcpython-d713b9ecac094a8d70877e51c3a2852553c6f284.tar.gz
Some more changes related to the new except syntax and semantics,
by Collin Winter.
Diffstat (limited to 'Python/compile.c')
-rw-r--r--Python/compile.c17
1 files changed, 5 insertions, 12 deletions
diff --git a/Python/compile.c b/Python/compile.c
index 481cc85886..e3bdaf5a1e 100644
--- a/Python/compile.c
+++ b/Python/compile.c
@@ -1956,16 +1956,13 @@ compiler_try_except(struct compiler *c, stmt_ty s)
ADDOP(c, POP_TOP);
if (handler->name) {
basicblock *cleanup_end, *cleanup_body;
- expr_context_ty orig_ctx;
-
- assert(handler->name->kind == Name_kind);
cleanup_end = compiler_new_block(c);
cleanup_body = compiler_new_block(c);
if(!(cleanup_end || cleanup_body))
return 0;
- VISIT(c, expr, handler->name);
+ compiler_nameop(c, handler->name, Store);
ADDOP(c, POP_TOP);
/*
@@ -1998,14 +1995,10 @@ compiler_try_except(struct compiler *c, stmt_ty s)
/* name = None */
ADDOP_O(c, LOAD_CONST, Py_None, consts);
- orig_ctx = handler->name->v.Name.ctx;
- handler->name->v.Name.ctx = Store;
- VISIT(c, expr, handler->name);
-
- /* del name */
- handler->name->v.Name.ctx = Del;
- VISIT(c, expr, handler->name);
- handler->name->v.Name.ctx = orig_ctx;
+ compiler_nameop(c, handler->name, Store);
+
+ /* del name */
+ compiler_nameop(c, handler->name, Del);
ADDOP(c, END_FINALLY);
compiler_pop_fblock(c, FINALLY_END, cleanup_end);