Skip to content

yggdrasil.pickle.ser.exceptions

exceptions

Exception serialization with full traceback support.

Wire format (version 2)

(2, exc_class, args, state, tb_frames, cause_data, context_data, suppress_context)

tb_frames        – ``None``  |  list of ``(filename, lineno, funcname, text)`` tuples
cause_data       – ``None``  |  bytes  (nested exception payload for ``__cause__``)
context_data     – ``None``  |  bytes  (nested exception payload for ``__context__``,

                                        omitted when identical to ``__cause__``)
suppress_context – bool      (mirrors ``exc.__suppress_context__``)

On deserialization the exception's __serialized_traceback__ attribute is set to a list of :class:TracebackFrame named-tuples (or None when no traceback was captured). __cause__ and __context__ are reconstructed recursively up to :data:_MAX_CHAIN_DEPTH levels.

BaseExceptionSerialized dataclass module-attribute

BaseExceptionSerialized = get_class(BASE_EXCEPTION) or BaseExceptionSerialized

Serializer for any :class:BaseException subclass.

Wire representation: :attr:Tags.BASE_EXCEPTION (tag 203) followed by a version 2 exception payload (see module docstring for the format).

The deserialized exception carries an additional __serialized_traceback__ attribute — a list of :class:TracebackFrame named-tuples when the original exception had a live traceback, or None otherwise.

TracebackFrame

Bases: NamedTuple

One frame from a serialized exception traceback.

Mirrors the attributes of :class:traceback.FrameSummary.

filename instance-attribute

filename: str

Absolute (or as-reported) source file path.

lineno instance-attribute

lineno: int

1-based line number within the source file.

name instance-attribute

name: str

Name of the function / method that owns the frame.

line instance-attribute

line: str | None

The source text of the line, or None when unavailable.