Skip to content

Commit 55caf8c

Browse files
Tweaks to traceback.format_list and from_list
1 parent cca6ee4 commit 55caf8c

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

stdlib/2and3/traceback.pyi

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Stubs for traceback
22

3-
from typing import Any, Dict, Generator, IO, Iterator, List, Mapping, Optional, Tuple, Type, Iterable
3+
from typing import Any, Dict, Generator, IO, Iterable, Iterator, List, Mapping, Optional, Tuple, Type, Union
44
from types import FrameType, TracebackType
55
import sys
66

@@ -35,6 +35,8 @@ if sys.version_info >= (3, 5):
3535
def extract_tb(tb: Optional[TracebackType], limit: Optional[int] = ...) -> StackSummary: ...
3636
def extract_stack(f: Optional[FrameType] = ...,
3737
limit: Optional[int] = ...) -> StackSummary: ...
38+
# TODO(https://bugs.python.org/issue34648): relax the type of
39+
# extracted_list to Iterable[FrameSummary].
3840
def format_list(extracted_list: List[FrameSummary]) -> List[str]: ...
3941
else:
4042
def extract_tb(tb: Optional[TracebackType], limit: Optional[int] = ...) -> List[_PT]: ...
@@ -111,6 +113,9 @@ if sys.version_info >= (3, 5):
111113
frame_gen: Generator[Tuple[FrameType, int], None, None],
112114
*, limit: Optional[int] = ..., lookup_lines: bool = ...,
113115
capture_locals: bool = ...) -> StackSummary: ...
116+
# TODO(https://bugs.python.org/issue34648): relax "a_list" to
117+
# Iterable[Union[_PT, FrameSummary]]... and then at some later point
118+
# drop support for _PT.
114119
@classmethod
115-
def from_list(cls, a_list: List[_PT]) -> StackSummary: ...
120+
def from_list(cls, a_list: List[Union[_PT, FrameSummary]]) -> StackSummary: ...
116121
def format(self) -> List[str]: ...

0 commit comments

Comments
 (0)