mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-02-17 01:24:47 +00:00
python312Packages.pydantic-core: fix build
Due a missing default value to the recursive_guard attribute we've seen this package fail to build from Python 3.12.4. https://hydra.nixos.org/build/263292352
This commit is contained in:
parent
41467202ed
commit
10a52dcfd3
@ -28,7 +28,13 @@ let
|
||||
hash = "sha256-RXytujvx/23Z24TWpvnHdjJ4/dXqjs5uiavUmukaD9A=";
|
||||
};
|
||||
|
||||
patches = [ ./01-remove-benchmark-flags.patch ];
|
||||
patches = [
|
||||
./01-remove-benchmark-flags.patch
|
||||
|
||||
# Fix missing recursive_guard paramter value on 3.12.4 and newer, based on
|
||||
# https://github.com/pydantic/pydantic-core/commit/d7946da7455fc269f69d6ae01abe2ba61266a0f2
|
||||
./python3.12.4-compat.patch
|
||||
];
|
||||
|
||||
cargoDeps = rustPlatform.fetchCargoTarball {
|
||||
inherit src;
|
||||
|
@ -0,0 +1,30 @@
|
||||
diff --git a/generate_self_schema.py b/generate_self_schema.py
|
||||
index 8d27247..814c88e 100644
|
||||
--- a/generate_self_schema.py
|
||||
+++ b/generate_self_schema.py
|
||||
@@ -9,6 +9,7 @@ from __future__ import annotations as _annotations
|
||||
import decimal
|
||||
import importlib.util
|
||||
import re
|
||||
+import sys
|
||||
from collections.abc import Callable
|
||||
from datetime import date, datetime, time, timedelta
|
||||
from pathlib import Path
|
||||
@@ -188,12 +189,12 @@ def all_literal_values(type_: type[core_schema.Literal]) -> list[any]:
|
||||
|
||||
|
||||
def eval_forward_ref(type_: Any) -> Any:
|
||||
- try:
|
||||
- return type_._evaluate(core_schema.__dict__, None, set())
|
||||
- except TypeError:
|
||||
- # for Python 3.8
|
||||
+ if sys.version_info < (3, 9):
|
||||
return type_._evaluate(core_schema.__dict__, None)
|
||||
-
|
||||
+ elif sys.version_info < (3, 12, 4):
|
||||
+ return type_._evaluate(core_schema.__dict__, None, recursive_guard=set())
|
||||
+ else:
|
||||
+ return type_._evaluate(core_schema.__dict__, None, type_params=set(), recursive_guard=set())
|
||||
|
||||
def main() -> None:
|
||||
schema_union = core_schema.CoreSchema
|
Loading…
Reference in New Issue
Block a user