File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -178,15 +178,16 @@ def bug1333982(x=[]):
178178 1 0 LOAD_CONST 0 (0)
179179 3 STORE_NAME 0 (x)
180180
181- 2 6 SETUP_LOOP 13 (to 22 )
181+ 2 6 SETUP_LOOP 14 (to 23 )
182182
183183 3 >> 9 LOAD_NAME 0 (x)
184184 12 LOAD_CONST 1 (1)
185185 15 INPLACE_ADD
186186 16 STORE_NAME 0 (x)
187187 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
190191"""
191192
192193dis_traceback = """\
Original file line number Diff line number Diff line change @@ -579,6 +579,15 @@ def jump_in_nested_finally(output):
579579jump_in_nested_finally .jump = (4 , 9 )
580580jump_in_nested_finally .output = [2 , 9 ]
581581
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+
582591# The second set of 'jump' tests are for things that are not allowed:
583592
584593def no_jump_too_far_forwards (output ):
@@ -755,6 +764,8 @@ def test_06_jump_to_same_line(self):
755764 self .run_test (jump_to_same_line )
756765 def test_07_jump_in_nested_finally (self ):
757766 self .run_test (jump_in_nested_finally )
767+ def test_jump_infinite_while_loop (self ):
768+ self .run_test (jump_infinite_while_loop )
758769 def test_08_no_jump_too_far_forwards (self ):
759770 self .run_test (no_jump_too_far_forwards )
760771 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
1010Core and Builtins
1111-----------------
1212
13+ - Issue #23048: Fix jumping out of an infinite while loop in the pdb.
14+
1315- Issue #20335: bytes constructor now raises TypeError when encoding or errors
1416 is specified with non-string argument. Based on patch by Renaud Blanch.
1517
Original file line number Diff line number Diff line change @@ -2029,10 +2029,9 @@ compiler_while(struct compiler *c, stmt_ty s)
20292029 if there is no else clause ?
20302030 */
20312031
2032- if (constant == -1 ) {
2032+ if (constant == -1 )
20332033 compiler_use_next_block (c , anchor );
2034- ADDOP (c , POP_BLOCK );
2035- }
2034+ ADDOP (c , POP_BLOCK );
20362035 compiler_pop_fblock (c , LOOP , loop );
20372036 if (orelse != NULL ) /* what if orelse is just pass? */
20382037 VISIT_SEQ (c , stmt , s -> v .While .orelse );
You can’t perform that action at this time.
0 commit comments