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

Method format

Lib/tracemalloc.py:236–254  ·  view source on GitHub ↗
(self, limit=None, most_recent_first=False)

Source from the content-addressed store, hash-verified

234 return s
235
236 def format(self, limit=None, most_recent_first=False):
237 lines = []
238 if limit is not None:
239 if limit > 0:
240 frame_slice = self[-limit:]
241 else:
242 frame_slice = self[:limit]
243 else:
244 frame_slice = self
245
246 if most_recent_first:
247 frame_slice = reversed(frame_slice)
248 for frame in frame_slice:
249 lines.append(' File "%s", line %s'
250 % (frame.filename, frame.lineno))
251 line = linecache.getline(frame.filename, frame.lineno).strip()
252 if line:
253 lines.append(' %s' % line)
254 return lines
255
256
257def get_object_traceback(obj):

Callers

nothing calls this directly

Calls 3

appendMethod · 0.45
stripMethod · 0.45
getlineMethod · 0.45

Tested by

no test coverage detected