MCPcopy Index your code
hub / github.com/python/cpython / test_new_reference

Method test_new_reference

Lib/test/test_tracemalloc.py:140–158  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

138 self.assertEqual(traceback, obj_traceback)
139
140 def test_new_reference(self):
141 tracemalloc.clear_traces()
142 # gc.collect() indirectly calls PyList_ClearFreeList()
143 support.gc_collect()
144
145 # Create a list and "destroy it": put it in the PyListObject free list
146 obj = []
147 obj = None
148
149 # Create a list which should reuse the previously created empty list
150 obj = []
151
152 nframe = tracemalloc.get_traceback_limit()
153 frames = get_frames(nframe, -3)
154 obj_traceback = tracemalloc.Traceback(frames, min(len(frames), nframe))
155
156 traceback = tracemalloc.get_object_traceback(obj)
157 self.assertIsNotNone(traceback)
158 self.assertEqual(traceback, obj_traceback)
159
160 def test_set_traceback_limit(self):
161 obj_size = 10

Callers

nothing calls this directly

Calls 3

get_framesFunction · 0.85
assertIsNotNoneMethod · 0.80
assertEqualMethod · 0.45

Tested by

no test coverage detected