From 8bd178e0c6a7cf2c8bbb603766df1f086920e76f Mon Sep 17 00:00:00 2001 From: M Bussonnier Date: Sun, 9 Feb 2025 13:32:56 -0800 Subject: [PATCH] Fix: incorrect type for Bdb.format_stack_entry (#13485) ```python def format_stack_entry(self, frame_lineno, lprefix=': '): ... frame, lineno = frame_lineno ``` The type of `frame_lineno` is `tuple[FrameType, int]` not `int`, understandably, since the type of `frame_lineno` can be interprted as the line number of the frame. But looking at the implementation of `Bdb.format_stack_entry`, it is clear that `frame_lineno` is a tuple. It is also necessary to somehow pass a frame to `format_stack_entry` if we want it to be formatted... --- stdlib/bdb.pyi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stdlib/bdb.pyi b/stdlib/bdb.pyi index 7e876af2e..2004874a5 100644 --- a/stdlib/bdb.pyi +++ b/stdlib/bdb.pyi @@ -78,7 +78,7 @@ class Bdb: def get_file_breaks(self, filename: str) -> list[Breakpoint]: ... def get_all_breaks(self) -> list[Breakpoint]: ... def get_stack(self, f: FrameType | None, t: TracebackType | None) -> tuple[list[tuple[FrameType, int]], int]: ... - def format_stack_entry(self, frame_lineno: int, lprefix: str = ": ") -> str: ... + def format_stack_entry(self, frame_lineno: tuple[FrameType, int], lprefix: str = ": ") -> str: ... def run( self, cmd: str | CodeType, globals: dict[str, Any] | None = None, locals: Mapping[str, Any] | None = None ) -> None: ...