Skip to content

Commit 98d6327

Browse files
authored
[pydoc] Update ErrorDuringImport (#15251)
1 parent bf0f0a5 commit 98d6327

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

stdlib/pydoc.pyi

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ from builtins import list as _list # "list" conflicts with method name
55
from collections.abc import Callable, Container, Mapping, MutableMapping
66
from reprlib import Repr
77
from types import MethodType, ModuleType, TracebackType
8-
from typing import IO, Any, AnyStr, Final, NoReturn, Protocol, TypeVar, type_check_only
8+
from typing import IO, Any, AnyStr, Final, NoReturn, Protocol, TypeVar, overload, type_check_only
99
from typing_extensions import TypeGuard, deprecated
1010

1111
__all__ = ["help"]
@@ -48,7 +48,14 @@ class ErrorDuringImport(Exception):
4848
exc: type[BaseException] | None
4949
value: BaseException | None
5050
tb: TracebackType | None
51-
def __init__(self, filename: str, exc_info: OptExcInfo) -> None: ...
51+
if sys.version_info >= (3, 12):
52+
@overload
53+
def __init__(self, filename: str, exc_info: BaseException) -> None: ...
54+
@overload
55+
@deprecated("A tuple value for `exc_info` parameter is deprecated since Python 3.12. Use an exception instance.")
56+
def __init__(self, filename: str, exc_info: OptExcInfo) -> None: ...
57+
else:
58+
def __init__(self, filename: str, exc_info: OptExcInfo) -> None: ...
5259

5360
def importfile(path: str) -> ModuleType: ...
5461
def safeimport(path: str, forceload: bool = ..., cache: MutableMapping[str, ModuleType] = {}) -> ModuleType | None: ...

0 commit comments

Comments
 (0)