mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-20 19:01:15 +08:00
Implement StartResponse using a protocol (#2392)
* Add ExcInfo and OptExcInfo type aliases * Implement StartResponse using a protocol * Mark stub-only types with an underscore * Remove wrong TODO note python/mypy#1178 is about variable-length tuples, while exc_info() always returns a tuple with length 3. Ideally, exc_info() would return Union[Tuple[Type[_E], _E, TracebackType], Tuple[None, None, None]], but that is a different issue.
This commit is contained in:
committed by
Jelle Zijlstra
parent
a2676ec972
commit
25ac4d6af4
@@ -6,6 +6,10 @@ from typing import (
|
||||
)
|
||||
from types import FrameType, ModuleType, TracebackType, ClassType
|
||||
|
||||
# The following type alias are stub-only and do not exist during runtime
|
||||
_ExcInfo = Tuple[Type[BaseException], BaseException, TracebackType]
|
||||
_OptExcInfo = Tuple[Optional[Type[BaseException]], Optional[BaseException], Optional[TracebackType]]
|
||||
|
||||
class _flags:
|
||||
bytes_warning = ... # type: int
|
||||
debug = ... # type: int
|
||||
@@ -112,10 +116,7 @@ def __displayhook__(value: int) -> None: ...
|
||||
def __excepthook__(type_: type, value: BaseException, traceback: TracebackType) -> None: ...
|
||||
def exc_clear() -> None:
|
||||
raise DeprecationWarning()
|
||||
# TODO should be a union of tuple, see mypy#1178
|
||||
def exc_info() -> Tuple[Optional[Type[BaseException]],
|
||||
Optional[BaseException],
|
||||
Optional[TracebackType]]: ...
|
||||
def exc_info() -> _OptExcInfo: ...
|
||||
|
||||
# sys.exit() accepts an optional argument of anything printable
|
||||
def exit(arg: Any = ...) -> NoReturn:
|
||||
|
||||
Reference in New Issue
Block a user