Module

server.debug.frames

Traceback frame extraction and framework collapsing.

Classes

FrameInfo 6
Extracted traceback frame with source context and locals.

Extracted traceback frame with source context and locals.

Attributes

Name Type Description
filename str
lineno int
func_name str
source_lines list[tuple[int, str]]
locals dict[str, str]
is_app bool
CollapsedFrameGroup 4
Consecutive non-app frames collapsed into a summary.

Consecutive non-app frames collapsed into a summary.

Attributes

Name Type Description
collapsed Literal[True]
count int
frames list[FrameInfo]
summary str

Functions

_is_app_frame 1 bool
True if the frame is from the application (not stdlib/site-packages).
def _is_app_frame(filename: str) -> bool
Parameters
Name Type Description
filename str
Returns
bool
_extract_frames 1 list[FrameInfo]
Walk a traceback and extract frame info with source context and locals.
def _extract_frames(tb: types.TracebackType | None) -> list[FrameInfo]
Parameters
Name Type Description
tb types.TracebackType | None
Returns
list[FrameInfo]
_collapse_framework_frames 2 list[FrameInfo | Collaps…
Collapse consecutive non-app (framework) frames into a summary. Reduces traceb…
def _collapse_framework_frames(frames: list[FrameInfo], min_collapse: int = 3) -> list[FrameInfo | CollapsedFrameGroup]

Collapse consecutive non-app (framework) frames into a summary.

Reduces traceback noise from middleware, ASGI adapters, etc. Returns a mix of frame dicts and collapsed-group dicts.

Parameters
Name Type Description
frames list[FrameInfo]
min_collapse int Default:3
Returns
list[FrameInfo | CollapsedFrameGroup]