GH-96612: Skip incomplete frames in tracemalloc traces. (GH-96613)

This commit is contained in:
Mark Shannon 2022-09-06 17:37:47 +01:00 committed by GitHub
parent f0d9136c69
commit 95e271b226
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 3 deletions

View file

@ -360,6 +360,20 @@ class TestTracemallocEnabled(unittest.TestCase):
else:
support.wait_process(pid, exitcode=0)
def test_no_incomplete_frames(self):
tracemalloc.stop()
tracemalloc.start(8)
def f(x):
def g():
return x
return g
obj = f(0).__closure__[0]
traceback = tracemalloc.get_object_traceback(obj)
self.assertIn("test_tracemalloc", traceback[-1].filename)
self.assertNotIn("test_tracemalloc", traceback[-2].filename)
class TestSnapshot(unittest.TestCase):
maxDiff = 4000