diff --git a/stdlib/pydoc.pyi b/stdlib/pydoc.pyi index 935f9420f88c..f8129ac20ade 100644 --- a/stdlib/pydoc.pyi +++ b/stdlib/pydoc.pyi @@ -5,7 +5,7 @@ from builtins import list as _list # "list" conflicts with method name from collections.abc import Callable, Container, Mapping, MutableMapping from reprlib import Repr from types import MethodType, ModuleType, TracebackType -from typing import IO, Any, AnyStr, Final, NoReturn, Protocol, TypeVar, type_check_only +from typing import IO, Any, AnyStr, Final, NoReturn, Protocol, TypeVar, overload, type_check_only from typing_extensions import TypeGuard, deprecated __all__ = ["help"] @@ -48,7 +48,14 @@ class ErrorDuringImport(Exception): exc: type[BaseException] | None value: BaseException | None tb: TracebackType | None - def __init__(self, filename: str, exc_info: OptExcInfo) -> None: ... + if sys.version_info >= (3, 12): + @overload + def __init__(self, filename: str, exc_info: BaseException) -> None: ... + @overload + @deprecated("A tuple value for `exc_info` parameter is deprecated since Python 3.12. Use an exception instance.") + def __init__(self, filename: str, exc_info: OptExcInfo) -> None: ... + else: + def __init__(self, filename: str, exc_info: OptExcInfo) -> None: ... def importfile(path: str) -> ModuleType: ... def safeimport(path: str, forceload: bool = ..., cache: MutableMapping[str, ModuleType] = {}) -> ModuleType | None: ...