MCPcopy Index your code
hub / github.com/mitmproxy/mitmproxy / cut_traceback

Function cut_traceback

mitmproxy/addonmanager.py:24–41  ·  view source on GitHub ↗

Cut off a traceback at the function with the given name. The func_name's frame is excluded. Args: tb: traceback object, as returned by sys.exc_info()[2] func_name: function name Returns: Reduced traceback.

(tb, func_name)

Source from the content-addressed store, hash-verified

22
23
24def cut_traceback(tb, func_name):
25 """
26 Cut off a traceback at the function with the given name.
27 The func_name's frame is excluded.
28
29 Args:
30 tb: traceback object, as returned by sys.exc_info()[2]
31 func_name: function name
32
33 Returns:
34 Reduced traceback.
35 """
36 tb_orig = tb
37 for _, _, fname, _ in traceback.extract_tb(tb):
38 tb = tb.tb_next
39 if fname == func_name:
40 break
41 return tb or tb_orig
42
43
44@contextlib.contextmanager

Callers 2

safecallFunction · 0.85
prettify_messageFunction · 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…