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...
This commit is contained in:
M Bussonnier
2025-02-09 13:32:56 -08:00
committed by GitHub
parent c99e54da3e
commit 8bd178e0c6

View File

@@ -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: ...