Remove PREDICTion of POP_BLOCK from FOR_ITER.
self.compare_events(doit_async.__code__.co_firstlineno,
tracer.events, events)
+ def test_loop_in_try_except(self):
+ # https://bugs.python.org/issue41670
+
+ def func():
+ try:
+ for i in []: pass
+ return 1
+ except:
+ return 2
+
+ self.run_and_compare(func,
+ [(0, 'call'),
+ (1, 'line'),
+ (2, 'line'),
+ (3, 'line'),
+ (3, 'return')])
+
class SkipLineEventsTraceTestCase(TraceTestCase):
"""Repeat the trace tests, but with per-line events skipped"""
--- /dev/null
+Prevent line trace being skipped on platforms not compiled
+with ``USE_COMPUTED_GOTOS``.
+Fixes issue where some lines nested within a try-except block
+were not being traced on Windows.
}
case TARGET(POP_BLOCK): {
- PREDICTED(POP_BLOCK);
PyFrame_BlockPop(f);
DISPATCH();
}
STACK_SHRINK(1);
Py_DECREF(iter);
JUMPBY(oparg);
- PREDICT(POP_BLOCK);
DISPATCH();
}