diff --git a/stdlib/@tests/stubtest_allowlists/py314.txt b/stdlib/@tests/stubtest_allowlists/py314.txt index 0749cba39..31067099c 100644 --- a/stdlib/@tests/stubtest_allowlists/py314.txt +++ b/stdlib/@tests/stubtest_allowlists/py314.txt @@ -160,7 +160,6 @@ tarfile.TarFile.zstopen threading.Thread.__init__ threading._RLock.locked tkinter.Event.__class_getitem__ -tomllib.TOMLDecodeError.__init__ turtle.__all__ turtle.RawTurtle.fill turtle.RawTurtle.poly diff --git a/stdlib/tomllib.pyi b/stdlib/tomllib.pyi index d559568b9..c160ffc38 100644 --- a/stdlib/tomllib.pyi +++ b/stdlib/tomllib.pyi @@ -1,10 +1,26 @@ +import sys from _typeshed import SupportsRead from collections.abc import Callable -from typing import Any +from typing import Any, overload +from typing_extensions import deprecated __all__ = ("loads", "load", "TOMLDecodeError") -class TOMLDecodeError(ValueError): ... +if sys.version_info >= (3, 14): + class TOMLDecodeError(ValueError): + msg: str + doc: str + pos: int + lineno: int + colno: int + @overload + def __init__(self, msg: str, doc: str, pos: int) -> None: ... + @overload + @deprecated("Deprecated in Python 3.14; Please set 'msg', 'doc' and 'pos' arguments only.") + def __init__(self, msg: str | type = ..., doc: str | type = ..., pos: int | type = ..., *args: Any) -> None: ... + +else: + class TOMLDecodeError(ValueError): ... def load(fp: SupportsRead[bytes], /, *, parse_float: Callable[[str], Any] = ...) -> dict[str, Any]: ... def loads(s: str, /, *, parse_float: Callable[[str], Any] = ...) -> dict[str, Any]: ...