traceback: Use _typeshed.SupportsWrite instead of typing.IO (#8442)

This commit is contained in:
Alan Isaac
2022-07-30 07:24:57 -04:00
committed by GitHub
parent f550c24886
commit a13e2339c4

View File

@@ -2,7 +2,7 @@ import sys
from _typeshed import Self, SupportsWrite
from collections.abc import Generator, Iterable, Iterator, Mapping
from types import FrameType, TracebackType
from typing import IO, Any, overload
from typing import Any, overload
from typing_extensions import Literal, TypeAlias
__all__ = [
@@ -29,7 +29,7 @@ __all__ = [
_PT: TypeAlias = tuple[str, int, str, str | None]
def print_tb(tb: TracebackType | None, limit: int | None = ..., file: IO[str] | None = ...) -> None: ...
def print_tb(tb: TracebackType | None, limit: int | None = ..., file: SupportsWrite[str] | None = ...) -> None: ...
if sys.version_info >= (3, 10):
@overload
@@ -38,12 +38,12 @@ if sys.version_info >= (3, 10):
value: BaseException | None = ...,
tb: TracebackType | None = ...,
limit: int | None = ...,
file: IO[str] | None = ...,
file: SupportsWrite[str] | None = ...,
chain: bool = ...,
) -> None: ...
@overload
def print_exception(
__exc: BaseException, *, limit: int | None = ..., file: IO[str] | None = ..., chain: bool = ...
__exc: BaseException, *, limit: int | None = ..., file: SupportsWrite[str] | None = ..., chain: bool = ...
) -> None: ...
@overload
def format_exception(
@@ -62,7 +62,7 @@ else:
value: BaseException | None,
tb: TracebackType | None,
limit: int | None = ...,
file: IO[str] | None = ...,
file: SupportsWrite[str] | None = ...,
chain: bool = ...,
) -> None: ...
def format_exception(
@@ -73,9 +73,9 @@ else:
chain: bool = ...,
) -> list[str]: ...
def print_exc(limit: int | None = ..., file: IO[str] | None = ..., chain: bool = ...) -> None: ...
def print_last(limit: int | None = ..., file: IO[str] | None = ..., chain: bool = ...) -> None: ...
def print_stack(f: FrameType | None = ..., limit: int | None = ..., file: IO[str] | None = ...) -> None: ...
def print_exc(limit: int | None = ..., file: SupportsWrite[str] | None = ..., chain: bool = ...) -> None: ...
def print_last(limit: int | None = ..., file: SupportsWrite[str] | None = ..., chain: bool = ...) -> None: ...
def print_stack(f: FrameType | None = ..., limit: int | None = ..., file: SupportsWrite[str] | None = ...) -> None: ...
def extract_tb(tb: TracebackType | None, limit: int | None = ...) -> StackSummary: ...
def extract_stack(f: FrameType | None = ..., limit: int | None = ...) -> StackSummary: ...
def format_list(extracted_list: list[FrameSummary]) -> list[str]: ...