Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion pkgs/development/python-modules/pydantic-core/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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