Mark instructions at end of class scope as artificial. (GH-24222)

This commit is contained in:
Mark Shannon 2021-01-15 13:52:00 +00:00 committed by GitHub
parent 4c94d74152
commit e56d54e447
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 0 deletions

View file

@ -956,6 +956,24 @@ class TraceTestCase(unittest.TestCase):
(2, 'line'),
(2, 'return')])
def test_implicit_return_in_class(self):
def func():
class A:
if 3 < 9:
a = 1
else:
a = 2
self.run_and_compare(func,
[(0, 'call'),
(1, 'line'),
(1, 'call'),
(1, 'line'),
(2, 'line'),
(3, 'line'),
(3, 'return'),
(1, 'return')])
class SkipLineEventsTraceTestCase(TraceTestCase):
"""Repeat the trace tests, but with per-line events skipped"""