mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-22 23:13:19 +00:00
python312Packages.pydantic: patch to work with python 3.12.4
It's mostly copy&paste from 10a52dcfd3
Example log:
https://hydra.nixos.org/build/263580234/nixlog/2/tail
This commit is contained in:
parent
a601f3f34f
commit
ff8149e411
@ -48,6 +48,7 @@ buildPythonPackage rec {
|
||||
url = "https://github.com/pydantic/pydantic/commit/825a6920e177a3b65836c13c7f37d82b810ce482.patch";
|
||||
hash = "sha256-Dap5DtDzHw0jS/QUo5CRI9sLDJ719GRyC4ZNDWEdzus=";
|
||||
})
|
||||
./python3.12.4-compat.patch
|
||||
];
|
||||
|
||||
buildInputs = lib.optionals (pythonOlder "3.9") [ libxcrypt ];
|
||||
|
@ -0,0 +1,22 @@
|
||||
--- a/pydantic/v1/typing.py
|
||||
+++ b/pydantic/v1/typing.py
|
||||
@@ -58,13 +58,18 @@
|
||||
def evaluate_forwardref(type_: ForwardRef, globalns: Any, localns: Any) -> Any:
|
||||
return type_._evaluate(globalns, localns)
|
||||
|
||||
-else:
|
||||
+elif sys.version_info < (3, 12, 4):
|
||||
|
||||
def evaluate_forwardref(type_: ForwardRef, globalns: Any, localns: Any) -> Any:
|
||||
# Even though it is the right signature for python 3.9, mypy complains with
|
||||
# `error: Too many arguments for "_evaluate" of "ForwardRef"` hence the cast...
|
||||
return cast(Any, type_)._evaluate(globalns, localns, set())
|
||||
|
||||
+else:
|
||||
+
|
||||
+ def evaluate_forwardref(type_: ForwardRef, globalns: Any, localns: Any) -> Any:
|
||||
+ return cast(Any, type_)._evaluate(globalns, localns, type_params=set(), recursive_guard=set())
|
||||
+
|
||||
|
||||
if sys.version_info < (3, 9):
|
||||
# Ensure we always get all the whole `Annotated` hint, not just the annotated type.
|
Loading…
Reference in New Issue
Block a user