Message ID | 20240612195026.3806547-1-raj.khem@gmail.com |
---|---|
State | New |
Headers | show |
Series | [meta-python] python3-pydantic-core: Fix build with python 3.12.4 | expand |
On Wed, Jun 12, 2024 at 12:50 PM Khem Raj <raj.khem@gmail.com> wrote: > This needs to be upgraded to 2.19+ but until then > backport a fix to keep it building. Thank you for the heads up. I’ll take a look tomorrow at the upgrade. > > Signed-off-by: Khem Raj <raj.khem@gmail.com> > Cc: Tim Orling <ticotimo@gmail.com> > --- > ...ate_self_schema-for-Python-3.12-1299.patch | 29 +++++++++++++++++++ > .../python/python3-pydantic-core_2.16.3.bb | 3 +- > 2 files changed, 31 insertions(+), 1 deletion(-) > create mode 100644 > meta-python/recipes-devtools/python/python3-pydantic-core/0001-Fix-generate_self_schema-for-Python-3.12-1299.patch > > diff --git > a/meta-python/recipes-devtools/python/python3-pydantic-core/0001-Fix-generate_self_schema-for-Python-3.12-1299.patch > b/meta-python/recipes-devtools/python/python3-pydantic-core/0001-Fix-generate_self_schema-for-Python-3.12-1299.patch > new file mode 100644 > index 0000000000..f6aa18e303 > --- /dev/null > +++ > b/meta-python/recipes-devtools/python/python3-pydantic-core/0001-Fix-generate_self_schema-for-Python-3.12-1299.patch > @@ -0,0 +1,29 @@ > +From 0dcca2ed6a83ebbc944ec8cbd2f67ffec8043461 Mon Sep 17 00:00:00 2001 > +From: Jelle Zijlstra <jelle.zijlstra@gmail.com> > +Date: Wed, 22 May 2024 07:44:10 -0700 > +Subject: [PATCH] Fix generate_self_schema for Python 3.12+ (#1299) > + > +Upstream-Status: Backport [ > https://github.com/pydantic/pydantic-core/commit/a7620419383a69bd2b28ab953c9a17f6ed35bb9a > ] > +Signed-off-by: Khem Raj <raj.khem@gmail.com> > +--- > + generate_self_schema.py | 7 ++++++- > + 1 file changed, 6 insertions(+), 1 deletion(-) > + > +diff --git a/generate_self_schema.py b/generate_self_schema.py > +index 8d27247..109fca0 100644 > +--- a/generate_self_schema.py > ++++ b/generate_self_schema.py > +@@ -189,7 +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()) > ++ try: > ++ # Python 3.12+ > ++ return type_._evaluate(core_schema.__dict__, None, > type_params=set(), recursive_guard=set()) > ++ except TypeError: > ++ # Python 3.9+ > ++ return type_._evaluate(core_schema.__dict__, None, set()) > + except TypeError: > + # for Python 3.8 > + return type_._evaluate(core_schema.__dict__, None) > diff --git a/meta-python/recipes-devtools/python/ > python3-pydantic-core_2.16.3.bb b/meta-python/recipes-devtools/python/ > python3-pydantic-core_2.16.3.bb > index f510645222..c5ce1ff110 100644 > --- a/meta-python/recipes-devtools/python/python3-pydantic-core_2.16.3.bb > +++ b/meta-python/recipes-devtools/python/python3-pydantic-core_2.16.3.bb > @@ -8,7 +8,8 @@ HOMEPAGE = "https://github.com/pydantic/pydantic-core" > LICENSE = "MIT" > LIC_FILES_CHKSUM = "file://LICENSE;md5=ab599c188b4a314d2856b3a55030c75c" > > -SRC_URI += > "file://0001-Bumps-pyo3-https-github.com-pyo3-pyo3-from-0.20.2-to.patch" > +SRC_URI += > "file://0001-Bumps-pyo3-https-github.com-pyo3-pyo3-from-0.20.2-to.patch \ > + > file://0001-Fix-generate_self_schema-for-Python-3.12-1299.patch" > SRC_URI[sha256sum] = > "1cac689f80a3abab2d3c0048b29eea5751114054f032a941a32de4c852c59cad" > > DEPENDS = "python3-maturin-native python3-typing-extensions" >
diff --git a/meta-python/recipes-devtools/python/python3-pydantic-core/0001-Fix-generate_self_schema-for-Python-3.12-1299.patch b/meta-python/recipes-devtools/python/python3-pydantic-core/0001-Fix-generate_self_schema-for-Python-3.12-1299.patch new file mode 100644 index 0000000000..f6aa18e303 --- /dev/null +++ b/meta-python/recipes-devtools/python/python3-pydantic-core/0001-Fix-generate_self_schema-for-Python-3.12-1299.patch @@ -0,0 +1,29 @@ +From 0dcca2ed6a83ebbc944ec8cbd2f67ffec8043461 Mon Sep 17 00:00:00 2001 +From: Jelle Zijlstra <jelle.zijlstra@gmail.com> +Date: Wed, 22 May 2024 07:44:10 -0700 +Subject: [PATCH] Fix generate_self_schema for Python 3.12+ (#1299) + +Upstream-Status: Backport [https://github.com/pydantic/pydantic-core/commit/a7620419383a69bd2b28ab953c9a17f6ed35bb9a] +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- + generate_self_schema.py | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +diff --git a/generate_self_schema.py b/generate_self_schema.py +index 8d27247..109fca0 100644 +--- a/generate_self_schema.py ++++ b/generate_self_schema.py +@@ -189,7 +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()) ++ try: ++ # Python 3.12+ ++ return type_._evaluate(core_schema.__dict__, None, type_params=set(), recursive_guard=set()) ++ except TypeError: ++ # Python 3.9+ ++ return type_._evaluate(core_schema.__dict__, None, set()) + except TypeError: + # for Python 3.8 + return type_._evaluate(core_schema.__dict__, None) diff --git a/meta-python/recipes-devtools/python/python3-pydantic-core_2.16.3.bb b/meta-python/recipes-devtools/python/python3-pydantic-core_2.16.3.bb index f510645222..c5ce1ff110 100644 --- a/meta-python/recipes-devtools/python/python3-pydantic-core_2.16.3.bb +++ b/meta-python/recipes-devtools/python/python3-pydantic-core_2.16.3.bb @@ -8,7 +8,8 @@ HOMEPAGE = "https://github.com/pydantic/pydantic-core" LICENSE = "MIT" LIC_FILES_CHKSUM = "file://LICENSE;md5=ab599c188b4a314d2856b3a55030c75c" -SRC_URI += "file://0001-Bumps-pyo3-https-github.com-pyo3-pyo3-from-0.20.2-to.patch" +SRC_URI += "file://0001-Bumps-pyo3-https-github.com-pyo3-pyo3-from-0.20.2-to.patch \ + file://0001-Fix-generate_self_schema-for-Python-3.12-1299.patch" SRC_URI[sha256sum] = "1cac689f80a3abab2d3c0048b29eea5751114054f032a941a32de4c852c59cad" DEPENDS = "python3-maturin-native python3-typing-extensions"
This needs to be upgraded to 2.19+ but until then backport a fix to keep it building. Signed-off-by: Khem Raj <raj.khem@gmail.com> Cc: Tim Orling <ticotimo@gmail.com> --- ...ate_self_schema-for-Python-3.12-1299.patch | 29 +++++++++++++++++++ .../python/python3-pydantic-core_2.16.3.bb | 3 +- 2 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 meta-python/recipes-devtools/python/python3-pydantic-core/0001-Fix-generate_self_schema-for-Python-3.12-1299.patch