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

Method from_list

Lib/traceback.py:526–542  ·  view source on GitHub ↗

Create a StackSummary object from a supplied list of FrameSummary objects or old-style list of tuples.

(klass, a_list)

Source from the content-addressed store, hash-verified

524
525 @classmethod
526 def from_list(klass, a_list):
527 """
528 Create a StackSummary object from a supplied list of
529 FrameSummary objects or old-style list of tuples.
530 """
531 # While doing a fast-path check for isinstance(a_list, StackSummary) is
532 # appealing, idlelib.run.cleanup_traceback and other similar code may
533 # break this by making arbitrary frames plain tuples, so we need to
534 # check on a frame by frame basis.
535 result = StackSummary()
536 for frame in a_list:
537 if isinstance(frame, FrameSummary):
538 result.append(frame)
539 else:
540 filename, lineno, name, line = frame
541 result.append(FrameSummary(filename, lineno, name, line=line))
542 return result
543
544 def format_frame_summary(self, frame_summary, **kwargs):
545 """Format the lines for a single FrameSummary.

Callers 5

print_listFunction · 0.45
format_listFunction · 0.45
test_from_listMethod · 0.45
test_format_smokeMethod · 0.45

Calls 3

StackSummaryClass · 0.85
FrameSummaryClass · 0.85
appendMethod · 0.45

Tested by 3

test_from_listMethod · 0.36
test_format_smokeMethod · 0.36