Skip to content
Open
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
14 changes: 14 additions & 0 deletions Lib/test/test_capi/test_opt.py
Original file line number Diff line number Diff line change
Expand Up @@ -5599,6 +5599,20 @@ def testfunc(n):
self.assertIn("_FOR_ITER_GEN_FRAME", uops)
self.assertIn("_SEND_VIRTUAL_TIER_TWO", uops)

def test_send_virtual_exhausted(self):
# gh-155823: warm up on a non-empty list, then take the exhausted exit.
def gen(x):
yield from x
def testfunc(n, x):
total = 0
for _ in range(n):
for v in gen(x):
total += v
return total

testfunc(TIER2_THRESHOLD * 10, [1])
self.assertEqual(testfunc(1000, []), 0)

def test_binary_op_subscr_init_frame(self):
class B:
def __getitem__(self, other):
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Fix a JIT bug where the side exit taken when a virtual iterator is exhausted
left a stale value on the stack, so the tier one interpreter resumed with
corrupted state and ``yield from`` raised :exc:`AttributeError` instead of
finishing normally.
2 changes: 0 additions & 2 deletions Python/bytecodes.c
Original file line number Diff line number Diff line change
Expand Up @@ -1785,8 +1785,6 @@ dummy_func(
if (index < 0) {
ERROR_NO_POP();
}
next = none;
DEAD(none);
EXIT_IF(true);
}
DEAD(none);
Expand Down
10 changes: 3 additions & 7 deletions Python/executor_cases.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading