bpo-41670: Remove outdated predict macro invocation. (GH-22026)

Remove PREDICTion of POP_BLOCK from FOR_ITER.
This commit is contained in:
Mark Shannon 2020-09-29 10:09:13 +01:00 committed by GitHub
parent 5b0181d1f6
commit 17b5be0c0a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 2 deletions

View File

@ -602,6 +602,23 @@ class TraceTestCase(unittest.TestCase):
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"""

View File

@ -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.

View File

@ -2311,7 +2311,6 @@ main_loop:
}
case TARGET(POP_BLOCK): {
PREDICTED(POP_BLOCK);
PyFrame_BlockPop(f);
DISPATCH();
}
@ -3366,7 +3365,6 @@ main_loop:
STACK_SHRINK(1);
Py_DECREF(iter);
JUMPBY(oparg);
PREDICT(POP_BLOCK);
DISPATCH();
}