fix indentation
This commit is contained in:
parent
dec2067b2a
commit
74897ba46f
100
Python/compile.c
100
Python/compile.c
|
@ -1977,7 +1977,7 @@ compiler_try_except(struct compiler *c, stmt_ty s)
|
||||||
compiler_use_next_block(c, except);
|
compiler_use_next_block(c, except);
|
||||||
for (i = 0; i < n; i++) {
|
for (i = 0; i < n; i++) {
|
||||||
excepthandler_ty handler = (excepthandler_ty)asdl_seq_GET(
|
excepthandler_ty handler = (excepthandler_ty)asdl_seq_GET(
|
||||||
s->v.TryExcept.handlers, i);
|
s->v.TryExcept.handlers, i);
|
||||||
if (!handler->v.ExceptHandler.type && i < n-1)
|
if (!handler->v.ExceptHandler.type && i < n-1)
|
||||||
return compiler_error(c, "default 'except:' must be last");
|
return compiler_error(c, "default 'except:' must be last");
|
||||||
c->u->u_lineno_set = 0;
|
c->u->u_lineno_set = 0;
|
||||||
|
@ -1993,70 +1993,70 @@ compiler_try_except(struct compiler *c, stmt_ty s)
|
||||||
}
|
}
|
||||||
ADDOP(c, POP_TOP);
|
ADDOP(c, POP_TOP);
|
||||||
if (handler->v.ExceptHandler.name) {
|
if (handler->v.ExceptHandler.name) {
|
||||||
basicblock *cleanup_end, *cleanup_body;
|
basicblock *cleanup_end, *cleanup_body;
|
||||||
|
|
||||||
cleanup_end = compiler_new_block(c);
|
cleanup_end = compiler_new_block(c);
|
||||||
cleanup_body = compiler_new_block(c);
|
cleanup_body = compiler_new_block(c);
|
||||||
if(!(cleanup_end || cleanup_body))
|
if(!(cleanup_end || cleanup_body))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
compiler_nameop(c, handler->v.ExceptHandler.name, Store);
|
compiler_nameop(c, handler->v.ExceptHandler.name, Store);
|
||||||
ADDOP(c, POP_TOP);
|
ADDOP(c, POP_TOP);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
try:
|
try:
|
||||||
# body
|
# body
|
||||||
except type as name:
|
except type as name:
|
||||||
try:
|
try:
|
||||||
# body
|
# body
|
||||||
finally:
|
finally:
|
||||||
name = None
|
name = None
|
||||||
del name
|
del name
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* second try: */
|
/* second try: */
|
||||||
ADDOP_JREL(c, SETUP_FINALLY, cleanup_end);
|
ADDOP_JREL(c, SETUP_FINALLY, cleanup_end);
|
||||||
compiler_use_next_block(c, cleanup_body);
|
compiler_use_next_block(c, cleanup_body);
|
||||||
if (!compiler_push_fblock(c, FINALLY_TRY, cleanup_body))
|
if (!compiler_push_fblock(c, FINALLY_TRY, cleanup_body))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* second # body */
|
/* second # body */
|
||||||
VISIT_SEQ(c, stmt, handler->v.ExceptHandler.body);
|
VISIT_SEQ(c, stmt, handler->v.ExceptHandler.body);
|
||||||
ADDOP(c, POP_BLOCK);
|
ADDOP(c, POP_BLOCK);
|
||||||
ADDOP(c, POP_EXCEPT);
|
ADDOP(c, POP_EXCEPT);
|
||||||
compiler_pop_fblock(c, FINALLY_TRY, cleanup_body);
|
compiler_pop_fblock(c, FINALLY_TRY, cleanup_body);
|
||||||
|
|
||||||
/* finally: */
|
/* finally: */
|
||||||
ADDOP_O(c, LOAD_CONST, Py_None, consts);
|
ADDOP_O(c, LOAD_CONST, Py_None, consts);
|
||||||
compiler_use_next_block(c, cleanup_end);
|
compiler_use_next_block(c, cleanup_end);
|
||||||
if (!compiler_push_fblock(c, FINALLY_END, cleanup_end))
|
if (!compiler_push_fblock(c, FINALLY_END, cleanup_end))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* name = None */
|
/* name = None */
|
||||||
ADDOP_O(c, LOAD_CONST, Py_None, consts);
|
ADDOP_O(c, LOAD_CONST, Py_None, consts);
|
||||||
compiler_nameop(c, handler->v.ExceptHandler.name, Store);
|
compiler_nameop(c, handler->v.ExceptHandler.name, Store);
|
||||||
|
|
||||||
/* del name */
|
/* del name */
|
||||||
compiler_nameop(c, handler->v.ExceptHandler.name, Del);
|
compiler_nameop(c, handler->v.ExceptHandler.name, Del);
|
||||||
|
|
||||||
ADDOP(c, END_FINALLY);
|
ADDOP(c, END_FINALLY);
|
||||||
compiler_pop_fblock(c, FINALLY_END, cleanup_end);
|
compiler_pop_fblock(c, FINALLY_END, cleanup_end);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
basicblock *cleanup_body;
|
basicblock *cleanup_body;
|
||||||
|
|
||||||
cleanup_body = compiler_new_block(c);
|
cleanup_body = compiler_new_block(c);
|
||||||
if(!cleanup_body)
|
if(!cleanup_body)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
ADDOP(c, POP_TOP);
|
ADDOP(c, POP_TOP);
|
||||||
ADDOP(c, POP_TOP);
|
ADDOP(c, POP_TOP);
|
||||||
compiler_use_next_block(c, cleanup_body);
|
compiler_use_next_block(c, cleanup_body);
|
||||||
if (!compiler_push_fblock(c, FINALLY_TRY, cleanup_body))
|
if (!compiler_push_fblock(c, FINALLY_TRY, cleanup_body))
|
||||||
return 0;
|
return 0;
|
||||||
VISIT_SEQ(c, stmt, handler->v.ExceptHandler.body);
|
VISIT_SEQ(c, stmt, handler->v.ExceptHandler.body);
|
||||||
ADDOP(c, POP_EXCEPT);
|
ADDOP(c, POP_EXCEPT);
|
||||||
compiler_pop_fblock(c, FINALLY_TRY, cleanup_body);
|
compiler_pop_fblock(c, FINALLY_TRY, cleanup_body);
|
||||||
}
|
}
|
||||||
ADDOP_JREL(c, JUMP_FORWARD, end);
|
ADDOP_JREL(c, JUMP_FORWARD, end);
|
||||||
compiler_use_next_block(c, except);
|
compiler_use_next_block(c, except);
|
||||||
|
|
Loading…
Reference in New Issue