traceback: Allow extracted_list params to be an Iterable containing tuples (#11675)

This commit is contained in:
Avasam
2024-03-30 21:32:27 -04:00
committed by GitHub
parent 2e240c9b08
commit 6cb57b5f26

View File

@@ -27,7 +27,7 @@ __all__ = [
"walk_tb",
]
_PT: TypeAlias = tuple[str, int, str, str | None]
_FrameSummaryTuple: TypeAlias = tuple[str, int, str, str | None]
def print_tb(tb: TracebackType | None, limit: int | None = None, file: SupportsWrite[str] | None = None) -> None: ...
@@ -80,10 +80,10 @@ def print_last(limit: int | None = None, file: SupportsWrite[str] | None = None,
def print_stack(f: FrameType | None = None, limit: int | None = None, file: SupportsWrite[str] | None = None) -> None: ...
def extract_tb(tb: TracebackType | None, limit: int | None = None) -> StackSummary: ...
def extract_stack(f: FrameType | None = None, limit: int | None = None) -> StackSummary: ...
def format_list(extracted_list: list[FrameSummary]) -> list[str]: ...
def format_list(extracted_list: Iterable[FrameSummary | _FrameSummaryTuple]) -> list[str]: ...
# undocumented
def print_list(extracted_list: list[FrameSummary], file: SupportsWrite[str] | None = None) -> None: ...
def print_list(extracted_list: Iterable[FrameSummary | _FrameSummaryTuple], file: SupportsWrite[str] | None = None) -> None: ...
if sys.version_info >= (3, 10):
@overload
@@ -255,7 +255,7 @@ class StackSummary(list[FrameSummary]):
capture_locals: bool = False,
) -> StackSummary: ...
@classmethod
def from_list(cls, a_list: Iterable[FrameSummary | _PT]) -> StackSummary: ...
def from_list(cls, a_list: Iterable[FrameSummary | _FrameSummaryTuple]) -> StackSummary: ...
if sys.version_info >= (3, 11):
def format_frame_summary(self, frame_summary: FrameSummary) -> str: ...