Improve traceback (#465)

This commit is contained in:
Valérian Rousset
2016-08-10 20:18:35 +02:00
committed by Guido van Rossum
parent 231ebbefaa
commit 4e55f0561f
4 changed files with 102 additions and 41 deletions

View File

@@ -5,7 +5,7 @@
from typing import (
List, Sequence, Any, Dict, Tuple, TextIO, overload, Optional, Union,
TypeVar, Callable
TypeVar, Callable, Type,
)
from types import TracebackType
@@ -118,7 +118,7 @@ def displayhook(value: Optional[int]) -> None: ...
def excepthook(type_: type, value: BaseException,
traceback: TracebackType) -> None: ...
# TODO should be a union of tuple, see mypy#1178
def exc_info() -> Tuple[Optional[type],
def exc_info() -> Tuple[Optional[Type[BaseException]],
Optional[BaseException],
Optional[TracebackType]]: ...
# sys.exit() accepts an optional argument of anything printable

View File

@@ -1,19 +0,0 @@
# Stubs for traceback
from typing import IO, List
from types import TracebackType, FrameType
import typing
# TODO signatures
def format_exception_only(etype, value) -> List[str]: ...
def format_exception(type: type, value: BaseException, tb: TracebackType, limit: int = ..., chain: bool = ...) -> List[str]: ...
def format_tb(traceback): ...
def print_exc(limit=..., file=..., chain=...): ...
def format_exc(limit: int = ..., chain: bool = ...) -> str: ...
def extract_stack(f=..., limit=...): ...
def extract_tb(traceback, limit=...): ...
def format_list(list): ...
def format_stack(f=..., limit=...) -> List[str]: ...
def print_stack(f: FrameType = ..., limit: int = ..., file: IO[str] = ...) -> None: ...
# TODO add more