Cherry-pick pyo3-ffi fix for Python 3.14 i686 segfaults

This commit is contained in:
Benjamin A. Beasley 2025-06-05 07:41:17 -04:00
commit bb81ac5e19
2 changed files with 36 additions and 0 deletions

View file

@ -0,0 +1,27 @@
From c42f6b171f1be6961c7f599405a29147862642b7 Mon Sep 17 00:00:00 2001
From: "Benjamin A. Beasley" <code@musicinmybrain.net>
Date: Wed, 4 Jun 2025 08:58:27 -0400
Subject: [PATCH] Make PyObjectObRefcnt.refcnt_and_flags 64-bit-only
Fix #5175 as described in
https://github.com/PyO3/pyo3/issues/5175#issuecomment-2939918138.
---
include/pyo3/pyo3-ffi/src/object.rs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/pyo3/pyo3-ffi/src/object.rs b/include/pyo3/pyo3-ffi/src/object.rs
index 5fbf45d..aeb9735 100644
--- a/include/pyo3/pyo3-ffi/src/object.rs
+++ b/include/pyo3/pyo3-ffi/src/object.rs
@@ -49,7 +49,7 @@ pub struct PyObjectObFlagsAndRefcnt {
pub union PyObjectObRefcnt {
#[cfg(all(target_pointer_width = "64", Py_3_14))]
pub ob_refcnt_full: crate::PY_INT64_T,
- #[cfg(Py_3_14)]
+ #[cfg(all(target_pointer_width = "64", Py_3_14))]
pub refcnt_and_flags: PyObjectObFlagsAndRefcnt,
pub ob_refcnt: Py_ssize_t,
#[cfg(all(target_pointer_width = "64", not(Py_3_14)))]
--
2.49.0

View file

@ -20,6 +20,15 @@ Source: %{pypi_source orjson}
# Support Python 3.14
# Updates bundled/forked pyo3-build-config/pyo3-ffi to 0.25.0
Patch: https://github.com/ijl/orjson/pull/570.patch
# Cherry-pick pyo3-ffi fix for Python 3.14 i686 segfaults:
#
# Make PyObjectObRefcnt.refcnt_and_flags 64-bit-only
# https://github.com/PyO3/pyo3/pull/5180
#
# Cherry-picked on top of https://github.com/ijl/orjson/pull/570 (without the
# commit adding a news fragment); see
# https://github.com/ijl/orjson/pull/570#issuecomment-2943844083.
Patch: 0001-Make-PyObjectObRefcnt.refcnt_and_flags-64-bit-only.patch
BuildRequires: tomcli
BuildRequires: python3-devel