diff --git a/pkgs/development/python-modules/tomli/default.nix b/pkgs/development/python-modules/tomli/default.nix index 19a0fe6135e5..c593e1e4cb19 100644 --- a/pkgs/development/python-modules/tomli/default.nix +++ b/pkgs/development/python-modules/tomli/default.nix @@ -7,7 +7,7 @@ buildPythonPackage rec { pname = "tomli"; - version = "1.2.1"; + version = "1.2.2"; format = "pyproject"; outputs = [ @@ -19,9 +19,14 @@ buildPythonPackage rec { owner = "hukkin"; repo = pname; rev = version; - sha256 = "sha256-30AQ9MQmclcjl1d83mIoxFXzaJn1OFKQlVxayqC5NxY="; + sha256 = "sha256-oDjpNzWxTaCC1+WyBKrkR6kp90ZomcZQfyW+xKddDoM="; }; + patches = [ + # required for mypy + ./fix-backwards-compatibility-load.patch + ]; + nativeBuildInputs = [ flit-core ]; postInstall = '' diff --git a/pkgs/development/python-modules/tomli/fix-backwards-compatibility-load.patch b/pkgs/development/python-modules/tomli/fix-backwards-compatibility-load.patch new file mode 100644 index 000000000000..edfc2f383495 --- /dev/null +++ b/pkgs/development/python-modules/tomli/fix-backwards-compatibility-load.patch @@ -0,0 +1,21 @@ +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: