tblib
¶
Submodules¶
Package Contents¶
Classes¶
Class that replicates just enough of the builtin Code object to enable serialization and traceback rendering. |
|
Class that replicates just enough of the builtin Frame object to enable serialization and traceback rendering. |
|
Class that wraps builtin Traceback objects. |
- exception tblib.TracebackParseError[source]¶
Bases:
Exception
Common base class for all non-exit exceptions.
- class tblib.Code(code)[source]¶
Class that replicates just enough of the builtin Code object to enable serialization and traceback rendering.
- co_code¶
- class tblib.Frame(frame, *, get_locals=None)[source]¶
Class that replicates just enough of the builtin Frame object to enable serialization and traceback rendering.
- Parameters:
get_locals (callable) – A function that take a frame argument and returns a dict.
See
Traceback
class for example.
- class tblib.Traceback(tb, *, get_locals=None)[source]¶
Class that wraps builtin Traceback objects.
- Parameters:
get_locals (callable) – A function that take a frame argument and returns a dict.
Ideally you will only return exactly what you need, and only with simple types that can be json serializable.
Example:
def get_locals(frame): if frame.f_locals.get("__tracebackhide__"): return {"__tracebackhide__": True} else: return {}
- tb_next¶
- to_traceback¶
- to_dict¶
- as_traceback()[source]¶
Convert to a builtin Traceback object that is usable for raising or rendering a stacktrace.
- as_dict()[source]¶
Converts to a dictionary representation. You can serialize the result to JSON as it only has builtin objects like dicts, lists, ints or strings.