bpo-47186: Replace JUMP_IF_NOT_EXC_MATCH by CHECK_EXC_MATCH + jump (GH-32231)

This commit is contained in:
Irit Katriel 2022-04-01 13:59:38 +01:00 committed by GitHub
parent ae9de82e32
commit 04e07c258f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 107 additions and 111 deletions

View file

@ -977,8 +977,8 @@ stack_effect(int opcode, int oparg, int jump)
case IS_OP:
case CONTAINS_OP:
return -1;
case JUMP_IF_NOT_EXC_MATCH:
return -1;
case CHECK_EXC_MATCH:
return 0;
case JUMP_IF_NOT_EG_MATCH:
return jump > 0 ? -1 : 0;
case IMPORT_NAME:
@ -3352,7 +3352,8 @@ compiler_try_star_finally(struct compiler *c, stmt_ty s)
[] JUMP L0
[exc] L1: <evaluate E1> )
[exc, E1] JUMP_IF_NOT_EXC_MATCH L2 ) only if E1
[exc, E1] CHECK_EXC_MATCH )
[exc, bool] POP_JUMP_IF_FALSE L2 ) only if E1
[exc] <assign to V1> (or POP if no V1)
[] <code for S1>
JUMP L0
@ -3410,7 +3411,8 @@ compiler_try_except(struct compiler *c, stmt_ty s)
return 0;
if (handler->v.ExceptHandler.type) {
VISIT(c, expr, handler->v.ExceptHandler.type);
ADDOP_JUMP(c, JUMP_IF_NOT_EXC_MATCH, except);
ADDOP(c, CHECK_EXC_MATCH);
ADDOP_JUMP(c, POP_JUMP_IF_FALSE, except);
}
if (handler->v.ExceptHandler.name) {
basicblock *cleanup_end, *cleanup_body;