diff --git a/stdlib/2/__builtin__.pyi b/stdlib/2/__builtin__.pyi index 24c93a18e857..650a19fa8a26 100644 --- a/stdlib/2/__builtin__.pyi +++ b/stdlib/2/__builtin__.pyi @@ -82,6 +82,7 @@ _T4 = TypeVar("_T4") _T5 = TypeVar("_T5") _TT = TypeVar("_TT", bound="type") _LT = TypeVar("_LT", bound=_SupportsLessThan) +_TBE = TypeVar("_TBE", bound="BaseException") class object: __doc__: Optional[str] @@ -1775,7 +1776,7 @@ class BaseException(object): def __getitem__(self, i: int) -> Any: ... def __getslice__(self, start: int, stop: int) -> Tuple[Any, ...]: ... if sys.version_info >= (3,): - def with_traceback(self, tb: Optional[TracebackType]) -> BaseException: ... + def with_traceback(self: _TBE, tb: Optional[TracebackType]) -> _TBE: ... class GeneratorExit(BaseException): ... class KeyboardInterrupt(BaseException): ... diff --git a/stdlib/2and3/builtins.pyi b/stdlib/2and3/builtins.pyi index 24c93a18e857..650a19fa8a26 100644 --- a/stdlib/2and3/builtins.pyi +++ b/stdlib/2and3/builtins.pyi @@ -82,6 +82,7 @@ _T4 = TypeVar("_T4") _T5 = TypeVar("_T5") _TT = TypeVar("_TT", bound="type") _LT = TypeVar("_LT", bound=_SupportsLessThan) +_TBE = TypeVar("_TBE", bound="BaseException") class object: __doc__: Optional[str] @@ -1775,7 +1776,7 @@ class BaseException(object): def __getitem__(self, i: int) -> Any: ... def __getslice__(self, start: int, stop: int) -> Tuple[Any, ...]: ... if sys.version_info >= (3,): - def with_traceback(self, tb: Optional[TracebackType]) -> BaseException: ... + def with_traceback(self: _TBE, tb: Optional[TracebackType]) -> _TBE: ... class GeneratorExit(BaseException): ... class KeyboardInterrupt(BaseException): ...