Add _typeshed.(Opt)ExcInfo (#7645)

This commit is contained in:
Sebastian Rittau
2022-04-18 01:28:43 +02:00
committed by GitHub
parent a24b765388
commit 321359ca31
7 changed files with 26 additions and 31 deletions

View File

@@ -1,18 +1,16 @@
import sys
from _typeshed import structseq
from _typeshed import OptExcInfo, structseq
from builtins import object as _object
from importlib.abc import PathEntryFinder
from importlib.machinery import ModuleSpec
from io import TextIOWrapper
from types import FrameType, ModuleType, TracebackType
from typing import Any, AsyncGenerator, Callable, Coroutine, NoReturn, Protocol, Sequence, TextIO, TypeVar, Union, overload
from typing import Any, AsyncGenerator, Callable, Coroutine, NoReturn, Protocol, Sequence, TextIO, TypeVar, overload
from typing_extensions import Literal, TypeAlias, final
_T = TypeVar("_T")
# The following type alias are stub-only and do not exist during runtime
_ExcInfo: TypeAlias = tuple[type[BaseException], BaseException, TracebackType]
_OptExcInfo: TypeAlias = Union[_ExcInfo, tuple[None, None, None]]
_OptExcInfo: TypeAlias = OptExcInfo # TODO: obsolete, remove fall 2022 or later
# Intentionally omits one deprecated and one optional method of `importlib.abc.MetaPathFinder`
class _MetaPathFinder(Protocol):
@@ -217,7 +215,7 @@ def _getframe(__depth: int = ...) -> FrameType: ...
def _debugmallocstats() -> None: ...
def __displayhook__(__value: object) -> None: ...
def __excepthook__(__exctype: type[BaseException], __value: BaseException, __traceback: TracebackType | None) -> None: ...
def exc_info() -> _OptExcInfo: ...
def exc_info() -> OptExcInfo: ...
# sys.exit() accepts an optional argument of anything printable
def exit(__status: object = ...) -> NoReturn: ...