File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -551,6 +551,15 @@ def jump_in_nested_finally(output):
551551jump_in_nested_finally .jump = (4 , 9 )
552552jump_in_nested_finally .output = [2 , 9 ]
553553
554+ def jump_infinite_while_loop (output ):
555+ output .append (1 )
556+ while 1 :
557+ output .append (2 )
558+ output .append (3 )
559+
560+ jump_infinite_while_loop .jump = (3 , 4 )
561+ jump_infinite_while_loop .output = [1 , 3 ]
562+
554563# The second set of 'jump' tests are for things that are not allowed:
555564
556565def no_jump_too_far_forwards (output ):
@@ -723,6 +732,8 @@ def test_06_jump_to_same_line(self):
723732 self .run_test (jump_to_same_line )
724733 def test_07_jump_in_nested_finally (self ):
725734 self .run_test (jump_in_nested_finally )
735+ def test_jump_infinite_while_loop (self ):
736+ self .run_test (jump_infinite_while_loop )
726737 def test_08_no_jump_too_far_forwards (self ):
727738 self .run_test (no_jump_too_far_forwards )
728739 def test_09_no_jump_too_far_backwards (self ):
Original file line number Diff line number Diff line change @@ -10,6 +10,8 @@ What's New in Python 2.7.10?
1010Core and Builtins
1111-----------------
1212
13+ - Issue #23048: Fix jumping out of an infinite while loop in the pdb.
14+
1315Library
1416-------
1517
Original file line number Diff line number Diff line change @@ -1716,10 +1716,9 @@ compiler_while(struct compiler *c, stmt_ty s)
17161716 if there is no else clause ?
17171717 */
17181718
1719- if (constant == -1 ) {
1719+ if (constant == -1 )
17201720 compiler_use_next_block (c , anchor );
1721- ADDOP (c , POP_BLOCK );
1722- }
1721+ ADDOP (c , POP_BLOCK );
17231722 compiler_pop_fblock (c , LOOP , loop );
17241723 if (orelse != NULL ) /* what if orelse is just pass? */
17251724 VISIT_SEQ (c , stmt , s -> v .While .orelse );
You can’t perform that action at this time.
0 commit comments