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

@@ -7,7 +7,8 @@ import ctypes
import mmap
import sys
from os import PathLike
from typing import AbstractSet, Any, Awaitable, Container, Generic, Iterable, Protocol, TypeVar
from types import TracebackType
from typing import AbstractSet, Any, Awaitable, Container, Generic, Iterable, Protocol, TypeVar, Union
from typing_extensions import Final, Literal, TypeAlias, final
_KT = TypeVar("_KT")
@@ -197,6 +198,9 @@ WriteableBuffer: TypeAlias = bytearray | memoryview | array.array[Any] | mmap.mm
# Same as _WriteableBuffer, but also includes read-only buffer types (like bytes).
ReadableBuffer: TypeAlias = ReadOnlyBuffer | WriteableBuffer # stable
ExcInfo: TypeAlias = tuple[type[BaseException], BaseException, TracebackType]
OptExcInfo: TypeAlias = Union[ExcInfo, tuple[None, None, None]]
# stable
if sys.version_info >= (3, 10):
from types import NoneType as NoneType

View File

@@ -5,7 +5,7 @@
# See the README.md file in this directory for more information.
import sys
from sys import _OptExcInfo
from _typeshed import OptExcInfo
from typing import Any, Callable, Iterable, Protocol
from typing_extensions import TypeAlias
@@ -19,7 +19,7 @@ else:
# stable
class StartResponse(Protocol):
def __call__(
self, __status: str, __headers: list[tuple[str, str]], __exc_info: _OptExcInfo | None = ...
self, __status: str, __headers: list[tuple[str, str]], __exc_info: OptExcInfo | None = ...
) -> Callable[[bytes], object]: ...
WSGIEnvironment: TypeAlias = dict[str, Any] # stable