summaryrefslogtreecommitdiffstats
path: root/Python/compile.c
diff options
context:
space:
mode:
Diffstat (limited to 'Python/compile.c')
-rw-r--r--Python/compile.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/Python/compile.c b/Python/compile.c
index 8e90b1a..48250b5 100644
--- a/Python/compile.c
+++ b/Python/compile.c
@@ -1134,7 +1134,7 @@ stack_effect(int opcode, int oparg, int jump)
return jump ? 1 : 0;
case PREP_RERAISE_STAR:
- return 0;
+ return -1;
case RERAISE:
return -1;
case PUSH_EXC_INFO:
@@ -3488,12 +3488,16 @@ compiler_try_except(struct compiler *c, stmt_ty s)
[orig, res, rest] Ln+1: LIST_APPEND 1 ) add unhandled exc to res (could be None)
[orig, res] PREP_RERAISE_STAR
- [i, exc] POP_JUMP_IF_TRUE RER
- [i, exc] POP
- [i] POP
+ [exc] DUP_TOP
+ [exc, exc] LOAD_CONST None
+ [exc, exc, None] COMPARE_IS
+ [exc, is_none] POP_JUMP_IF_FALSE RER
+ [exc] POP_TOP
[] JUMP_FORWARD L0
- [i, exc] RER: POP_EXCEPT_AND_RERAISE
+ [exc] RER: ROT_TWO
+ [exc, prev_exc_info] POP_EXCEPT
+ [exc] RERAISE 0
[] L0: <next statement>
*/
@@ -3657,18 +3661,21 @@ compiler_try_star_except(struct compiler *c, stmt_ty s)
compiler_use_next_block(c, reraise_star);
ADDOP(c, PREP_RERAISE_STAR);
ADDOP(c, DUP_TOP);
- ADDOP_JUMP(c, POP_JUMP_IF_TRUE, reraise);
+ ADDOP_LOAD_CONST(c, Py_None);
+ ADDOP_COMPARE(c, Is);
+ ADDOP_JUMP(c, POP_JUMP_IF_FALSE, reraise);
NEXT_BLOCK(c);
- /* Nothing to reraise - pop it */
- ADDOP(c, POP_TOP);
+ /* Nothing to reraise */
ADDOP(c, POP_TOP);
ADDOP(c, POP_BLOCK);
ADDOP(c, POP_EXCEPT);
ADDOP_JUMP(c, JUMP_FORWARD, end);
compiler_use_next_block(c, reraise);
ADDOP(c, POP_BLOCK);
- ADDOP(c, POP_EXCEPT_AND_RERAISE);
+ ADDOP(c, ROT_TWO);
+ ADDOP(c, POP_EXCEPT);
+ ADDOP_I(c, RERAISE, 0);
compiler_use_next_block(c, cleanup);
ADDOP(c, POP_EXCEPT_AND_RERAISE);
compiler_use_next_block(c, orelse);