diff --git a/stdlib/2and3/traceback.pyi b/stdlib/2and3/traceback.pyi index 2b83b5dcb..45108bf22 100644 --- a/stdlib/2and3/traceback.pyi +++ b/stdlib/2and3/traceback.pyi @@ -28,10 +28,17 @@ else: file: Optional[IO[str]] = ...) -> None: ... def print_stack(f: Optional[FrameType] = ..., limit: Optional[int] = ..., file: Optional[IO[str]] = ...) -> None: ... -def extract_tb(tb: Optional[TracebackType], limit: Optional[int] = ...) -> List[_PT]: ... -def extract_stack(f: Optional[FrameType] = ..., - limit: Optional[int] = ...) -> List[_PT]: ... -def format_list(extracted_list: List[_PT]) -> List[str]: ... + +if sys.version_info >= (3, 5): + def extract_tb(tb: Optional[TracebackType], limit: Optional[int] = ...) -> StackSummary: ... + def extract_stack(f: Optional[FrameType] = ..., + limit: Optional[int] = ...) -> StackSummary: ... + def format_list(extracted_list: List[FrameSummary]) -> List[str]: ... +else: + def extract_tb(tb: Optional[TracebackType], limit: Optional[int] = ...) -> List[_PT]: ... + def extract_stack(f: Optional[FrameType] = ..., + limit: Optional[int] = ...) -> List[_PT]: ... + def format_list(extracted_list: List[_PT]) -> List[str]: ... def format_exception_only(etype: Type[BaseException], value: BaseException) -> List[str]: ... if sys.version_info >= (3,): @@ -82,7 +89,13 @@ if sys.version_info >= (3, 5): if sys.version_info >= (3, 5): - class StackSummary: + class FrameSummary: + def __init__(self, filename: str, lineno: int, name: str, + lookup_line: bool = ..., + locals: Optional[Mapping[str, str]] = ..., + line: Optional[int] = ...) -> None: ... + + class StackSummary(List[FrameSummary]): @classmethod def extract(cls, frame_gen: Generator[Tuple[FrameType, int], None, None], @@ -90,11 +103,3 @@ if sys.version_info >= (3, 5): capture_locals: bool = ...) -> StackSummary: ... @classmethod def from_list(cls, a_list: List[_PT]) -> StackSummary: ... - - -if sys.version_info >= (3, 5): - class FrameSummary: - def __init__(self, filename: str, lineno: int, name: str, - lookup_line: bool = ..., - locals: Optional[Mapping[str, str]] = ..., - line: Optional[int] = ...) -> None: ...