File tree 4 files changed +19
-6
lines changed
4 files changed +19
-6
lines changed Original file line number Diff line number Diff line change @@ -178,15 +178,16 @@ def bug1333982(x=[]):
178
178
1 0 LOAD_CONST 0 (0)
179
179
3 STORE_NAME 0 (x)
180
180
181
- 2 6 SETUP_LOOP 13 (to 22 )
181
+ 2 6 SETUP_LOOP 14 (to 23 )
182
182
183
183
3 >> 9 LOAD_NAME 0 (x)
184
184
12 LOAD_CONST 1 (1)
185
185
15 INPLACE_ADD
186
186
16 STORE_NAME 0 (x)
187
187
19 JUMP_ABSOLUTE 9
188
- >> 22 LOAD_CONST 2 (None)
189
- 25 RETURN_VALUE
188
+ 22 POP_BLOCK
189
+ >> 23 LOAD_CONST 2 (None)
190
+ 26 RETURN_VALUE
190
191
"""
191
192
192
193
dis_traceback = """\
Original file line number Diff line number Diff line change @@ -579,6 +579,15 @@ def jump_in_nested_finally(output):
579
579
jump_in_nested_finally .jump = (4 , 9 )
580
580
jump_in_nested_finally .output = [2 , 9 ]
581
581
582
+ def jump_infinite_while_loop (output ):
583
+ output .append (1 )
584
+ while 1 :
585
+ output .append (2 )
586
+ output .append (3 )
587
+
588
+ jump_infinite_while_loop .jump = (3 , 4 )
589
+ jump_infinite_while_loop .output = [1 , 3 ]
590
+
582
591
# The second set of 'jump' tests are for things that are not allowed:
583
592
584
593
def no_jump_too_far_forwards (output ):
@@ -755,6 +764,8 @@ def test_06_jump_to_same_line(self):
755
764
self .run_test (jump_to_same_line )
756
765
def test_07_jump_in_nested_finally (self ):
757
766
self .run_test (jump_in_nested_finally )
767
+ def test_jump_infinite_while_loop (self ):
768
+ self .run_test (jump_infinite_while_loop )
758
769
def test_08_no_jump_too_far_forwards (self ):
759
770
self .run_test (no_jump_too_far_forwards )
760
771
def test_09_no_jump_too_far_backwards (self ):
Original file line number Diff line number Diff line change @@ -10,6 +10,8 @@ Release date: TBA
10
10
Core and Builtins
11
11
-----------------
12
12
13
+ - Issue #23048: Fix jumping out of an infinite while loop in the pdb.
14
+
13
15
- Issue #20335: bytes constructor now raises TypeError when encoding or errors
14
16
is specified with non-string argument. Based on patch by Renaud Blanch.
15
17
Original file line number Diff line number Diff line change @@ -2029,10 +2029,9 @@ compiler_while(struct compiler *c, stmt_ty s)
2029
2029
if there is no else clause ?
2030
2030
*/
2031
2031
2032
- if (constant == -1 ) {
2032
+ if (constant == -1 )
2033
2033
compiler_use_next_block (c , anchor );
2034
- ADDOP (c , POP_BLOCK );
2035
- }
2034
+ ADDOP (c , POP_BLOCK );
2036
2035
compiler_pop_fblock (c , LOOP , loop );
2037
2036
if (orelse != NULL ) /* what if orelse is just pass? */
2038
2037
VISIT_SEQ (c , stmt , s -> v .While .orelse );
You can’t perform that action at this time.
0 commit comments