Skip to content

[3.12] GH-94438: Restore ability to jump over None tests (GH-111237) #111243

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions Lib/test/test_sys_settrace.py
Original file line number Diff line number Diff line change
Expand Up @@ -2033,6 +2033,40 @@ def test_jump_simple_backwards(output):
output.append(1)
output.append(2)

@jump_test(1, 4, [5])
def test_jump_is_none_forwards(output):
x = None
if x is None:
output.append(3)
else:
output.append(5)

@jump_test(6, 5, [3, 5, 6])
def test_jump_is_none_backwards(output):
x = None
if x is None:
output.append(3)
else:
output.append(5)
output.append(6)

@jump_test(1, 4, [5])
def test_jump_is_not_none_forwards(output):
x = None
if x is not None:
output.append(3)
else:
output.append(5)

@jump_test(6, 5, [5, 5, 6])
def test_jump_is_not_none_backwards(output):
x = None
if x is not None:
output.append(3)
else:
output.append(5)
output.append(6)

@jump_test(3, 5, [2, 5], warning=(RuntimeWarning, unbound_locals))
def test_jump_out_of_block_forwards(output):
for i in 1, 2:
Expand Down
1 change: 1 addition & 0 deletions Misc/ACKS
Original file line number Diff line number Diff line change
Expand Up @@ -1342,6 +1342,7 @@ Michele Orrù
Tomáš Orsava
Oleg Oshmyan
Denis Osipov
Savannah Ostrowski
Denis S. Otkidach
Peter Otten
Michael Otteneder
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix a regression that prevented jumping across ``is None`` and ``is not None`` when debugging. Patch by Savannah Ostrowski.
2 changes: 2 additions & 0 deletions Objects/frameobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,8 @@ mark_stacks(PyCodeObject *code_obj, int len)
switch (opcode) {
case POP_JUMP_IF_FALSE:
case POP_JUMP_IF_TRUE:
case POP_JUMP_IF_NONE:
case POP_JUMP_IF_NOT_NONE:
{
int64_t target_stack;
int j = next_i + oparg;
Expand Down