bpo-42635: Mark JUMP_ABSOLUTE at end of 'for' loop as artificial to avoid spurious line events. (GH-23761)

This commit is contained in:
Mark Shannon 2020-12-14 11:28:39 +00:00 committed by GitHub
parent 56aa20f9eb
commit f5e97b72fe
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 3803 additions and 3775 deletions

View file

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