diff --git a/.gitignore b/.gitignore index 1a34795..7e6e659 100644 --- a/.gitignore +++ b/.gitignore @@ -21,3 +21,4 @@ /pyo3-0.21.1.crate /pyo3-0.21.2.crate /pyo3-0.22.0.crate +/pyo3-0.22.2.crate diff --git a/0001-Make-unsafe-subinterpreter-support-available-via-cfg.patch b/0001-Make-unsafe-subinterpreter-support-available-via-cfg.patch new file mode 100644 index 0000000..ffcdfb6 --- /dev/null +++ b/0001-Make-unsafe-subinterpreter-support-available-via-cfg.patch @@ -0,0 +1,25 @@ +From d59176bc05aa37838fd4a8dd253f47c962f61118 Mon Sep 17 00:00:00 2001 +From: Fabio Valentini +Date: Tue, 23 Jul 2024 14:41:04 +0200 +Subject: [PATCH] Make unsafe subinterpreter support available via cfg flag + +--- + src/impl_/pymodule.rs | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/impl_/pymodule.rs b/src/impl_/pymodule.rs +index b05652b..94555ff 100644 +--- a/src/impl_/pymodule.rs ++++ b/src/impl_/pymodule.rs +@@ -107,7 +107,7 @@ impl ModuleDef { + // that static data is not reused across interpreters. + // + // PyPy does not have subinterpreters, so no need to check interpreter ID. +- #[cfg(not(any(PyPy, GraalPy)))] ++ #[cfg(not(any(PyPy, GraalPy, pyo3_unsafe_allow_subinterpreters)))] + { + // PyInterpreterState_Get is only available on 3.9 and later, but is missing + // from python3.dll for Windows stable API on 3.9 +-- +2.45.2 + diff --git a/0001-fix-regression-in-128-bit-number-conversions.patch b/0001-fix-regression-in-128-bit-number-conversions.patch deleted file mode 100644 index 6d8d879..0000000 --- a/0001-fix-regression-in-128-bit-number-conversions.patch +++ /dev/null @@ -1,54 +0,0 @@ -From 0654258b18d314c83d6a3e78c4030d22b6b3ea75 Mon Sep 17 00:00:00 2001 -From: Fabio Valentini -Date: Wed, 26 Jun 2024 18:52:08 +0200 -Subject: [PATCH] fix regression in 128-bit number conversions - ---- - src/conversions/std/num.rs | 23 +++++++++++++---------- - 1 file changed, 13 insertions(+), 10 deletions(-) - -diff --git a/src/conversions/std/num.rs b/src/conversions/std/num.rs -index effe7c7..1304e73 100644 ---- a/src/conversions/std/num.rs -+++ b/src/conversions/std/num.rs -@@ -238,15 +238,18 @@ mod fast_128bit_int_conversion { - unsafe { ffi::PyNumber_Index(ob.as_ptr()).assume_owned_or_err(ob.py())? }; - let mut buffer = [0u8; std::mem::size_of::<$rust_type>()]; - #[cfg(not(Py_3_13))] -- crate::err::error_on_minusone(ob.py(), unsafe { -- ffi::_PyLong_AsByteArray( -- num.as_ptr() as *mut ffi::PyLongObject, -- buffer.as_mut_ptr(), -- buffer.len(), -- 1, -- $is_signed.into(), -- ) -- })?; -+ { -+ crate::err::error_on_minusone(ob.py(), unsafe { -+ ffi::_PyLong_AsByteArray( -+ num.as_ptr() as *mut ffi::PyLongObject, -+ buffer.as_mut_ptr(), -+ buffer.len(), -+ 1, -+ $is_signed.into(), -+ ) -+ })?; -+ Ok(<$rust_type>::from_le_bytes(buffer)) -+ } - #[cfg(Py_3_13)] - { - let mut flags = ffi::Py_ASNATIVEBYTES_NATIVE_ENDIAN; -@@ -272,8 +275,8 @@ mod fast_128bit_int_conversion { - "Python int larger than 128 bits", - )); - } -+ Ok(<$rust_type>::from_ne_bytes(buffer)) - } -- Ok(<$rust_type>::from_ne_bytes(buffer)) - } - - #[cfg(feature = "experimental-inspect")] --- -2.45.2 - diff --git a/pyo3-fix-metadata.diff b/pyo3-fix-metadata.diff index e5f22f3..fa30a96 100644 --- a/pyo3-fix-metadata.diff +++ b/pyo3-fix-metadata.diff @@ -1,5 +1,5 @@ ---- pyo3-0.22.0/Cargo.toml 1970-01-01T00:00:01+00:00 -+++ pyo3-0.22.0/Cargo.toml 2024-06-25T10:43:21.348671+00:00 +--- pyo3-0.22.2/Cargo.toml 1970-01-01T00:00:01+00:00 ++++ pyo3-0.22.2/Cargo.toml 2024-07-23T12:35:05.486015+00:00 @@ -239,7 +239,6 @@ "serde", "smallvec", diff --git a/rust-pyo3.spec b/rust-pyo3.spec index 9abbdc4..a6e1513 100644 --- a/rust-pyo3.spec +++ b/rust-pyo3.spec @@ -5,7 +5,7 @@ %global crate pyo3 Name: rust-pyo3 -Version: 0.22.0 +Version: 0.22.2 Release: %autorelease Summary: Bindings to Python interpreter @@ -15,8 +15,10 @@ Source: %{crates_source} # Manually created patch for downstream crate metadata changes # * drop MSVC- and MinGW-only features Patch: pyo3-fix-metadata.diff -# https://github.com/PyO3/pyo3/issues/4290 -Patch: 0001-fix-regression-in-128-bit-number-conversions.patch + +# * make unsafe subinterpreter support available via cfg flag: +# https://bugzilla.redhat.com/show_bug.cgi?id=2298403 +Patch: 0001-Make-unsafe-subinterpreter-support-available-via-cfg.patch BuildRequires: cargo-rpm-macros >= 24 diff --git a/sources b/sources index d72404a..91e9d55 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (pyo3-0.22.0.crate) = 44e0237fd3a8d4c7b082c48a5c8a52d8f4cc4673d134f680e29504bb46d870015fa210da34de4c1998defbcd4afdf2aaea4e148fbe093e4b2c8b0d064cd48da4 +SHA512 (pyo3-0.22.2.crate) = e8bae09059f50ffe477dad44499cedeaf3a734665f0fd8e8bd4b44f48578d21e4bdb8d55ceea00c5a27da750761842ddf89cfcecdecb2e7a4a17ab192259be9c