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

Class StackTreeItem

Lib/idlelib/stackviewer.py:22–46  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

20
21
22class StackTreeItem(TreeItem):
23
24 def __init__(self, exc, flist=None):
25 self.flist = flist
26 self.stack = self.get_stack(None if exc is None else exc.__traceback__)
27 self.text = f"{type(exc).__name__}: {str(exc)}"
28
29 def get_stack(self, tb):
30 stack = []
31 if tb and tb.tb_frame is None:
32 tb = tb.tb_next
33 while tb is not None:
34 stack.append((tb.tb_frame, tb.tb_lineno))
35 tb = tb.tb_next
36 return stack
37
38 def GetText(self): # Titlecase names are overrides.
39 return self.text
40
41 def GetSubList(self):
42 sublist = []
43 for info in self.stack:
44 item = FrameTreeItem(info, self.flist)
45 sublist.append(item)
46 return sublist
47
48
49class FrameTreeItem(TreeItem):

Callers 1

StackBrowserFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…