Skip to content

Commit c40482e

Browse files
committed
pythongh-107901: synthetic jumps which are not end of loop should not check the eval breaker
1 parent b30bed0 commit c40482e

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

Python/compile.c

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2897,7 +2897,7 @@ compiler_jump_if(struct compiler *c, location loc,
28972897
compiler_jump_if(c, loc, e->v.IfExp.test, next2, 0));
28982898
RETURN_IF_ERROR(
28992899
compiler_jump_if(c, loc, e->v.IfExp.body, next, cond));
2900-
ADDOP_JUMP(c, NO_LOCATION, JUMP, end);
2900+
ADDOP_JUMP(c, NO_LOCATION, JUMP_NO_INTERRUPT, end);
29012901

29022902
USE_LABEL(c, next2);
29032903
RETURN_IF_ERROR(
@@ -2926,12 +2926,12 @@ compiler_jump_if(struct compiler *c, location loc,
29262926
ADDOP(c, LOC(e), TO_BOOL);
29272927
ADDOP_JUMP(c, LOC(e), cond ? POP_JUMP_IF_TRUE : POP_JUMP_IF_FALSE, next);
29282928
NEW_JUMP_TARGET_LABEL(c, end);
2929-
ADDOP_JUMP(c, NO_LOCATION, JUMP, end);
2929+
ADDOP_JUMP(c, NO_LOCATION, JUMP_NO_INTERRUPT, end);
29302930

29312931
USE_LABEL(c, cleanup);
29322932
ADDOP(c, LOC(e), POP_TOP);
29332933
if (!cond) {
2934-
ADDOP_JUMP(c, NO_LOCATION, JUMP, next);
2934+
ADDOP_JUMP(c, NO_LOCATION, JUMP_NO_INTERRUPT, next);
29352935
}
29362936

29372937
USE_LABEL(c, end);
@@ -2963,7 +2963,7 @@ compiler_ifexp(struct compiler *c, expr_ty e)
29632963
compiler_jump_if(c, LOC(e), e->v.IfExp.test, next, 0));
29642964

29652965
VISIT(c, expr, e->v.IfExp.body);
2966-
ADDOP_JUMP(c, NO_LOCATION, JUMP, end);
2966+
ADDOP_JUMP(c, NO_LOCATION, JUMP_NO_INTERRUPT, end);
29672967

29682968
USE_LABEL(c, next);
29692969
VISIT(c, expr, e->v.IfExp.orelse);
@@ -3041,7 +3041,7 @@ compiler_if(struct compiler *c, stmt_ty s)
30413041

30423042
VISIT_SEQ(c, stmt, s->v.If.body);
30433043
if (asdl_seq_LEN(s->v.If.orelse)) {
3044-
ADDOP_JUMP(c, NO_LOCATION, JUMP, end);
3044+
ADDOP_JUMP(c, NO_LOCATION, JUMP_NO_INTERRUPT, end);
30453045

30463046
USE_LABEL(c, next);
30473047
VISIT_SEQ(c, stmt, s->v.If.orelse);
@@ -3294,7 +3294,7 @@ compiler_try_finally(struct compiler *c, stmt_ty s)
32943294
compiler_pop_fblock(c, FINALLY_TRY, body);
32953295
VISIT_SEQ(c, stmt, s->v.Try.finalbody);
32963296

3297-
ADDOP_JUMP(c, NO_LOCATION, JUMP, exit);
3297+
ADDOP_JUMP(c, NO_LOCATION, JUMP_NO_INTERRUPT, exit);
32983298
/* `finally` block */
32993299

33003300
USE_LABEL(c, end);
@@ -3344,7 +3344,7 @@ compiler_try_star_finally(struct compiler *c, stmt_ty s)
33443344
compiler_pop_fblock(c, FINALLY_TRY, body);
33453345
VISIT_SEQ(c, stmt, s->v.TryStar.finalbody);
33463346

3347-
ADDOP_JUMP(c, NO_LOCATION, JUMP, exit);
3347+
ADDOP_JUMP(c, NO_LOCATION, JUMP_NO_INTERRUPT, exit);
33483348

33493349
/* `finally` block */
33503350
USE_LABEL(c, end);
@@ -3419,7 +3419,7 @@ compiler_try_except(struct compiler *c, stmt_ty s)
34193419
if (s->v.Try.orelse && asdl_seq_LEN(s->v.Try.orelse)) {
34203420
VISIT_SEQ(c, stmt, s->v.Try.orelse);
34213421
}
3422-
ADDOP_JUMP(c, NO_LOCATION, JUMP, end);
3422+
ADDOP_JUMP(c, NO_LOCATION, JUMP_NO_INTERRUPT, end);
34233423
n = asdl_seq_LEN(s->v.Try.handlers);
34243424

34253425
USE_LABEL(c, except);
@@ -3483,7 +3483,7 @@ compiler_try_except(struct compiler *c, stmt_ty s)
34833483
compiler_nameop(c, NO_LOCATION, handler->v.ExceptHandler.name, Store));
34843484
RETURN_IF_ERROR(
34853485
compiler_nameop(c, NO_LOCATION, handler->v.ExceptHandler.name, Del));
3486-
ADDOP_JUMP(c, NO_LOCATION, JUMP, end);
3486+
ADDOP_JUMP(c, NO_LOCATION, JUMP_NO_INTERRUPT, end);
34873487

34883488
/* except: */
34893489
USE_LABEL(c, cleanup_end);
@@ -3511,7 +3511,7 @@ compiler_try_except(struct compiler *c, stmt_ty s)
35113511
compiler_pop_fblock(c, HANDLER_CLEANUP, cleanup_body);
35123512
ADDOP(c, NO_LOCATION, POP_BLOCK);
35133513
ADDOP(c, NO_LOCATION, POP_EXCEPT);
3514-
ADDOP_JUMP(c, NO_LOCATION, JUMP, end);
3514+
ADDOP_JUMP(c, NO_LOCATION, JUMP_NO_INTERRUPT, end);
35153515
}
35163516

35173517
USE_LABEL(c, except);
@@ -3599,7 +3599,7 @@ compiler_try_star_except(struct compiler *c, stmt_ty s)
35993599
VISIT_SEQ(c, stmt, s->v.TryStar.body);
36003600
compiler_pop_fblock(c, TRY_EXCEPT, body);
36013601
ADDOP(c, NO_LOCATION, POP_BLOCK);
3602-
ADDOP_JUMP(c, NO_LOCATION, JUMP, orelse);
3602+
ADDOP_JUMP(c, NO_LOCATION, JUMP_NO_INTERRUPT, orelse);
36033603
Py_ssize_t n = asdl_seq_LEN(s->v.TryStar.handlers);
36043604

36053605
USE_LABEL(c, except);
@@ -3681,7 +3681,7 @@ compiler_try_star_except(struct compiler *c, stmt_ty s)
36813681
RETURN_IF_ERROR(
36823682
compiler_nameop(c, NO_LOCATION, handler->v.ExceptHandler.name, Del));
36833683
}
3684-
ADDOP_JUMP(c, NO_LOCATION, JUMP, except);
3684+
ADDOP_JUMP(c, NO_LOCATION, JUMP_NO_INTERRUPT, except);
36853685

36863686
/* except: */
36873687
USE_LABEL(c, cleanup_end);
@@ -3698,11 +3698,11 @@ compiler_try_star_except(struct compiler *c, stmt_ty s)
36983698
/* add exception raised to the res list */
36993699
ADDOP_I(c, NO_LOCATION, LIST_APPEND, 3); // exc
37003700
ADDOP(c, NO_LOCATION, POP_TOP); // lasti
3701-
ADDOP_JUMP(c, NO_LOCATION, JUMP, except_with_error);
3701+
ADDOP_JUMP(c, NO_LOCATION, JUMP_NO_INTERRUPT, except_with_error);
37023702

37033703
USE_LABEL(c, except);
37043704
ADDOP(c, NO_LOCATION, NOP); // to hold a propagated location info
3705-
ADDOP_JUMP(c, NO_LOCATION, JUMP, except_with_error);
3705+
ADDOP_JUMP(c, NO_LOCATION, JUMP_NO_INTERRUPT, except_with_error);
37063706

37073707
USE_LABEL(c, no_match);
37083708
ADDOP(c, loc, POP_TOP); // match (None)
@@ -3712,7 +3712,7 @@ compiler_try_star_except(struct compiler *c, stmt_ty s)
37123712
if (i == n - 1) {
37133713
/* Add exc to the list (if not None it's the unhandled part of the EG) */
37143714
ADDOP_I(c, NO_LOCATION, LIST_APPEND, 1);
3715-
ADDOP_JUMP(c, NO_LOCATION, JUMP, reraise_star);
3715+
ADDOP_JUMP(c, NO_LOCATION, JUMP_NO_INTERRUPT, reraise_star);
37163716
}
37173717
}
37183718
/* artificial */
@@ -3728,7 +3728,7 @@ compiler_try_star_except(struct compiler *c, stmt_ty s)
37283728
ADDOP(c, NO_LOCATION, POP_TOP);
37293729
ADDOP(c, NO_LOCATION, POP_BLOCK);
37303730
ADDOP(c, NO_LOCATION, POP_EXCEPT);
3731-
ADDOP_JUMP(c, NO_LOCATION, JUMP, end);
3731+
ADDOP_JUMP(c, NO_LOCATION, JUMP_NO_INTERRUPT, end);
37323732

37333733
USE_LABEL(c, reraise);
37343734
ADDOP(c, NO_LOCATION, POP_BLOCK);
@@ -4626,7 +4626,7 @@ compiler_compare(struct compiler *c, expr_ty e)
46264626
VISIT(c, expr, (expr_ty)asdl_seq_GET(e->v.Compare.comparators, n));
46274627
ADDOP_COMPARE(c, loc, asdl_seq_GET(e->v.Compare.ops, n));
46284628
NEW_JUMP_TARGET_LABEL(c, end);
4629-
ADDOP_JUMP(c, NO_LOCATION, JUMP, end);
4629+
ADDOP_JUMP(c, NO_LOCATION, JUMP_NO_INTERRUPT, end);
46304630

46314631
USE_LABEL(c, cleanup);
46324632
ADDOP_I(c, loc, SWAP, 2);
@@ -5668,7 +5668,7 @@ pop_inlined_comprehension_state(struct compiler *c, location loc,
56685668
}
56695669
if (state.pushed_locals) {
56705670
ADDOP(c, NO_LOCATION, POP_BLOCK);
5671-
ADDOP_JUMP(c, NO_LOCATION, JUMP, state.end);
5671+
ADDOP_JUMP(c, NO_LOCATION, JUMP_NO_INTERRUPT, state.end);
56725672

56735673
// cleanup from an exception inside the comprehension
56745674
USE_LABEL(c, state.cleanup);
@@ -5916,7 +5916,7 @@ compiler_with_except_finish(struct compiler *c, jump_target_label cleanup) {
59165916
ADDOP(c, NO_LOCATION, POP_TOP);
59175917
ADDOP(c, NO_LOCATION, POP_TOP);
59185918
NEW_JUMP_TARGET_LABEL(c, exit);
5919-
ADDOP_JUMP(c, NO_LOCATION, JUMP, exit);
5919+
ADDOP_JUMP(c, NO_LOCATION, JUMP_NO_INTERRUPT, exit);
59205920

59215921
USE_LABEL(c, cleanup);
59225922
POP_EXCEPT_AND_RERAISE(c, NO_LOCATION);
@@ -7410,7 +7410,7 @@ compiler_match_inner(struct compiler *c, stmt_ty s, pattern_context *pc)
74107410
ADDOP(c, LOC(m->pattern), POP_TOP);
74117411
}
74127412
VISIT_SEQ(c, stmt, m->body);
7413-
ADDOP_JUMP(c, NO_LOCATION, JUMP, end);
7413+
ADDOP_JUMP(c, NO_LOCATION, JUMP_NO_INTERRUPT, end);
74147414
// If the pattern fails to match, we want the line number of the
74157415
// cleanup to be associated with the failed pattern, not the last line
74167416
// of the body

0 commit comments

Comments
 (0)