summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Shannon <mark@hotpy.org>2020-09-29 10:09:13 +0100
committerGitHub <noreply@github.com>2020-09-29 10:09:13 +0100
commit17b5be0c0a3f74141014e06a660f1b5ddb002fec (patch)
treedbab380ec65937f6957064856eb5f33d77ca56aa
parent5b0181d1f6474c2cb9b80bdaf3bc56a78bf5fbe7 (diff)
downloadcpython-git-17b5be0c0a3f74141014e06a660f1b5ddb002fec.tar.gz
bpo-41670: Remove outdated predict macro invocation. (GH-22026)
Remove PREDICTion of POP_BLOCK from FOR_ITER.
-rw-r--r--Lib/test/test_sys_settrace.py17
-rw-r--r--Misc/NEWS.d/next/Core and Builtins/2020-08-31-11-37-59.bpo-41670.vmRJRx.rst4
-rw-r--r--Python/ceval.c2
3 files changed, 21 insertions, 2 deletions
diff --git a/Lib/test/test_sys_settrace.py b/Lib/test/test_sys_settrace.py
index 3f902b1fe7..dd4418dd98 100644
--- a/Lib/test/test_sys_settrace.py
+++ b/Lib/test/test_sys_settrace.py
@@ -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"""
diff --git a/Misc/NEWS.d/next/Core and Builtins/2020-08-31-11-37-59.bpo-41670.vmRJRx.rst b/Misc/NEWS.d/next/Core and Builtins/2020-08-31-11-37-59.bpo-41670.vmRJRx.rst
new file mode 100644
index 0000000000..6ad5fb6dc9
--- /dev/null
+++ b/Misc/NEWS.d/next/Core and Builtins/2020-08-31-11-37-59.bpo-41670.vmRJRx.rst
@@ -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.
diff --git a/Python/ceval.c b/Python/ceval.c
index 6430e792b8..6bd2d6bc13 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -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();
}