bpo-41670: Remove outdated predict macro invocation. (GH-22026)
Remove PREDICTion of POP_BLOCK from FOR_ITER.
This commit is contained in:
parent
5b0181d1f6
commit
17b5be0c0a
|
@ -602,6 +602,23 @@ class TraceTestCase(unittest.TestCase):
|
||||||
self.compare_events(doit_async.__code__.co_firstlineno,
|
self.compare_events(doit_async.__code__.co_firstlineno,
|
||||||
tracer.events, events)
|
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):
|
class SkipLineEventsTraceTestCase(TraceTestCase):
|
||||||
"""Repeat the trace tests, but with per-line events skipped"""
|
"""Repeat the trace tests, but with per-line events skipped"""
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
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.
|
|
@ -2311,7 +2311,6 @@ main_loop:
|
||||||
}
|
}
|
||||||
|
|
||||||
case TARGET(POP_BLOCK): {
|
case TARGET(POP_BLOCK): {
|
||||||
PREDICTED(POP_BLOCK);
|
|
||||||
PyFrame_BlockPop(f);
|
PyFrame_BlockPop(f);
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
}
|
}
|
||||||
|
@ -3366,7 +3365,6 @@ main_loop:
|
||||||
STACK_SHRINK(1);
|
STACK_SHRINK(1);
|
||||||
Py_DECREF(iter);
|
Py_DECREF(iter);
|
||||||
JUMPBY(oparg);
|
JUMPBY(oparg);
|
||||||
PREDICT(POP_BLOCK);
|
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue