From 98d6327550e45e2afa48f4824a97037b16a4449b Mon Sep 17 00:00:00 2001 From: Semyon Moroz Date: Sat, 10 Jan 2026 23:22:53 +0000 Subject: [PATCH] [pydoc] Update ErrorDuringImport (#15251) --- stdlib/pydoc.pyi | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/stdlib/pydoc.pyi b/stdlib/pydoc.pyi index 935f9420f..f8129ac20 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: ...