Documentation
¶
Overview ¶
Package traceback ports cpython/Python/traceback.c. v0.3 ships the data shape, the format/print entry points, and a minimal frameless builder used by the errors package to attach traceback rows from Go call sites. Real frames join in v0.6 once the VM lands.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Type *objects.Type
Type is the type singleton for the `traceback` builtin type.
CPython: Python/traceback.c:269 PyTraceBack_Type
Functions ¶
func Format ¶
Format returns the multi-line traceback string, oldest entry first. Mirrors traceback.format_tb output.
CPython: Python/traceback.c:L985 _PyTraceBack_FromFrame
func FormatException ¶
FormatException prepends typeName: message to a Format(tb) output, matching `traceback.format_exception` for a single (no-chain) exception. The errors package walks the cause/context chain itself and calls FormatException per node.
CPython: Python/traceback.c:L1129 _PyTraceBack_Print
Types ¶
type Entry ¶
Entry is one line of a traceback. Mirrors the data carried by PyTracebackObject (filename, line number, function name).
CPython: Objects/frameobject.h (analog) and Python/traceback.c
type Traceback ¶
type Traceback struct {
objects.Header
Entry Entry
Next *Traceback
TbFrame objects.Object
TbLasti int
}
Traceback is the linked list of entries that backs Python's `__traceback__`. The next pointer chains older frames; CPython stores the chain in reverse, with the newest frame at the head.
In CPython this is the PyTracebackObject struct exposed as the builtin `traceback` type. The Entry field carries the position data the original v0.3 port used (file/line/name); TbFrame and TbLasti are the slots that match CPython's tb_frame / tb_lasti once a real frame is available. Either the Entry path or the TbFrame path is enough to drive Format.
CPython: Include/cpython/traceback.h:L9 PyTracebackObject