@@ -3586,16 +3586,15 @@ compiler_try_except(struct compiler *c, stmt_ty s)
3586
3586
[] POP_BLOCK
3587
3587
[] JUMP L0
3588
3588
3589
- [exc] L1: COPY 1 ) save copy of the original exception
3590
- [orig, exc] BUILD_LIST ) list for raised/reraised excs ("result")
3591
- [orig, exc, res] SWAP 2
3589
+ [exc] L1: BUILD_LIST ) list for raised/reraised excs ("result")
3590
+ [orig, res] COPY 2 ) make a copy of the original EG
3592
3591
3593
3592
[orig, res, exc] <evaluate E1>
3594
3593
[orig, res, exc, E1] CHECK_EG_MATCH
3595
- [orig, red , rest/exc, match?] COPY 1
3596
- [orig, red , rest/exc, match?, match?] POP_JUMP_IF_NOT_NONE H1
3597
- [orig, red , exc, None] POP_TOP
3598
- [orig, red , exc] JUMP L2
3594
+ [orig, res , rest/exc, match?] COPY 1
3595
+ [orig, res , rest/exc, match?, match?] POP_JUMP_IF_NOT_NONE H1
3596
+ [orig, res , exc, None] POP_TOP
3597
+ [orig, res , exc] JUMP L2
3599
3598
3600
3599
[orig, res, rest, match] H1: <assign to V1> (or POP if no V1)
3601
3600
@@ -3664,21 +3663,17 @@ compiler_try_star_except(struct compiler *c, stmt_ty s)
3664
3663
except = next_except ;
3665
3664
NEW_JUMP_TARGET_LABEL (c , handle_match );
3666
3665
if (i == 0 ) {
3667
- /* Push the original EG into the stack */
3666
+ /* create empty list for exceptions raised/reraise in the except* blocks */
3668
3667
/*
3669
- [exc] COPY 1
3670
- [orig, exc]
3668
+ [orig] BUILD_LIST
3671
3669
*/
3672
- ADDOP_I (c , loc , COPY , 1 );
3673
-
3674
- /* create empty list for exceptions raised/reraise in the except* blocks */
3670
+ /* Creat a copy of the original EG */
3675
3671
/*
3676
- [orig, exc] BUILD_LIST
3677
- [orig, exc, []] SWAP 2
3672
+ [orig, []] COPY 2
3678
3673
[orig, [], exc]
3679
3674
*/
3680
3675
ADDOP_I (c , loc , BUILD_LIST , 0 );
3681
- ADDOP_I (c , loc , SWAP , 2 );
3676
+ ADDOP_I (c , loc , COPY , 2 );
3682
3677
}
3683
3678
if (handler -> v .ExceptHandler .type ) {
3684
3679
VISIT (c , expr , handler -> v .ExceptHandler .type );
0 commit comments