Skip to content

Commit 7ced53c

Browse files
committed
merge 3.4 (#23048)
2 parents 050ca65 + 3cda0ed commit 7ced53c

File tree

4 files changed

+19
-6
lines changed

4 files changed

+19
-6
lines changed

Lib/test/test_dis.py

+4-3
Original file line numberDiff line numberDiff 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

192193
dis_traceback = """\

Lib/test/test_sys_settrace.py

+11
Original file line numberDiff line numberDiff line change
@@ -579,6 +579,15 @@ def jump_in_nested_finally(output):
579579
jump_in_nested_finally.jump = (4, 9)
580580
jump_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

584593
def 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):

Misc/NEWS

+2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ Release date: TBA
1010
Core 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

Python/compile.c

+2-3
Original file line numberDiff line numberDiff 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);

0 commit comments

Comments
 (0)