nixpkgs/pkgs/development/python-modules/tomli/fix-backwards-compatibility-load.patch

21 lines
797 B
Diff

diff --git a/tomli/_parser.py b/tomli/_parser.py
index 89e81c3..6fb1bfd 100644
--- a/tomli/_parser.py
+++ b/tomli/_parser.py
@@ -1,6 +1,6 @@
import string
from types import MappingProxyType
-from typing import Any, BinaryIO, Dict, FrozenSet, Iterable, NamedTuple, Optional, Tuple
+from typing import IO, Union, Any, BinaryIO, Dict, FrozenSet, Iterable, NamedTuple, Optional, Tuple
import warnings
from tomli._re import (
@@ -48,7 +48,7 @@ class TOMLDecodeError(ValueError):
"""An error raised if a document is not valid TOML."""
-def load(fp: BinaryIO, *, parse_float: ParseFloat = float) -> Dict[str, Any]:
+def load(fp: Union[IO, BinaryIO], *, parse_float: ParseFloat = float) -> Dict[str, Any]:
"""Parse TOML from a binary file object."""
s_bytes = fp.read()
try: