Change format_exception_only to work with exception value on first/second arg

This commit is contained in:
Numerlor
2023-07-20 14:44:00 +02:00
committed by GitHub
parent 79e092e133
commit b3eb4b95a2

View File

@@ -1,5 +1,5 @@
import sys
from _typeshed import SupportsWrite
from _typeshed import SupportsWrite, Unused
from collections.abc import Generator, Iterable, Iterator, Mapping
from types import FrameType, TracebackType
from typing import Any, overload
@@ -84,7 +84,10 @@ def format_list(extracted_list: list[FrameSummary]) -> list[str]: ...
def print_list(extracted_list: list[FrameSummary], file: SupportsWrite[str] | None = None) -> None: ...
if sys.version_info >= (3, 10):
def format_exception_only(__exc: type[BaseException] | None, value: BaseException | None = ...) -> list[str]: ...
@overload
def format_exception_only(__exc: BaseException | None) -> list[str]: ...
@overload
def format_exception_only(__exc: Unused, value: BaseException | None) -> list[str]: ...
else:
def format_exception_only(etype: type[BaseException] | None, value: BaseException | None) -> list[str]: ...