summaryrefslogtreecommitdiffstats
path: root/Python/compile.c
diff options
context:
space:
mode:
authorIrit Katriel <1055913+iritkatriel@users.noreply.github.com>2022-04-01 12:59:38 (GMT)
committerGitHub <noreply@github.com>2022-04-01 12:59:38 (GMT)
commit04e07c258f4f2ac85e25355242a113f98a706f04 (patch)
tree166df77e0d1e0bbaf6c4fcd8b1f3584010cf6c26 /Python/compile.c
parentae9de82e321581e1906c6ef2a7ad83ab30ae3325 (diff)
downloadcpython-04e07c258f4f2ac85e25355242a113f98a706f04.zip
cpython-04e07c258f4f2ac85e25355242a113f98a706f04.tar.gz
cpython-04e07c258f4f2ac85e25355242a113f98a706f04.tar.bz2
bpo-47186: Replace JUMP_IF_NOT_EXC_MATCH by CHECK_EXC_MATCH + jump (GH-32231)
Diffstat (limited to 'Python/compile.c')
-rw-r--r--Python/compile.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/Python/compile.c b/Python/compile.c
index 7a07377..bdf886b 100644
--- a/Python/compile.c
+++ b/Python/compile.c
@@ -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;