summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorMark Shannon <mark@hotpy.org>2022-09-06 16:37:47 (GMT)
committerGitHub <noreply@github.com>2022-09-06 16:37:47 (GMT)
commit95e271b2266b8f2e7b60ede86ccf3ede4a7f83eb (patch)
tree1e0f787da14d97d825b8349b9871caaf12d6f573 /Lib
parentf0d9136c69b4ed32bfb3096f926da098623a7072 (diff)
downloadcpython-95e271b2266b8f2e7b60ede86ccf3ede4a7f83eb.zip
cpython-95e271b2266b8f2e7b60ede86ccf3ede4a7f83eb.tar.gz
cpython-95e271b2266b8f2e7b60ede86ccf3ede4a7f83eb.tar.bz2
GH-96612: Skip incomplete frames in tracemalloc traces. (GH-96613)
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_tracemalloc.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/Lib/test/test_tracemalloc.py b/Lib/test/test_tracemalloc.py
index d2a5ede..94bcee3 100644
--- a/Lib/test/test_tracemalloc.py
+++ b/Lib/test/test_tracemalloc.py
@@ -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