summaryrefslogtreecommitdiff
path: root/Lib/test/test_sys_settrace.py
diff options
context:
space:
mode:
authorMark Shannon <mark@hotpy.org>2020-12-14 11:28:39 +0000
committerGitHub <noreply@github.com>2020-12-14 11:28:39 +0000
commitf5e97b72fecff9b9ced35704ec5e6cad29e2825d (patch)
tree34916b20fc3c72265458d8dac99f2f288c24e545 /Lib/test/test_sys_settrace.py
parent56aa20f9eb913c746b7d54b90be328c922639338 (diff)
downloadcpython-git-f5e97b72fecff9b9ced35704ec5e6cad29e2825d.tar.gz
bpo-42635: Mark JUMP_ABSOLUTE at end of 'for' loop as artificial to avoid spurious line events. (GH-23761)
Diffstat (limited to 'Lib/test/test_sys_settrace.py')
-rw-r--r--Lib/test/test_sys_settrace.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/Lib/test/test_sys_settrace.py b/Lib/test/test_sys_settrace.py
index f257809021..37013e51c9 100644
--- a/Lib/test/test_sys_settrace.py
+++ b/Lib/test/test_sys_settrace.py
@@ -646,6 +646,32 @@ class TraceTestCase(unittest.TestCase):
(6, 'line'),
(6, 'return')])
+ def test_nested_loops(self):
+
+ def func():
+ for i in range(2):
+ for j in range(2):
+ a = i + j
+ return a == 1
+
+ self.run_and_compare(func,
+ [(0, 'call'),
+ (1, 'line'),
+ (2, 'line'),
+ (3, 'line'),
+ (2, 'line'),
+ (3, 'line'),
+ (2, 'line'),
+ (1, 'line'),
+ (2, 'line'),
+ (3, 'line'),
+ (2, 'line'),
+ (3, 'line'),
+ (2, 'line'),
+ (1, 'line'),
+ (4, 'line'),
+ (4, 'return')])
+
class SkipLineEventsTraceTestCase(TraceTestCase):
"""Repeat the trace tests, but with per-line events skipped"""