commit: 8533cab5b68e924799c8ff54a825ad504ad359c6
Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Thu Jul 17 01:38:30 2025 +0000
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Thu Jul 17 02:41:05 2025 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8533cab5
dev-python/cython: Backport ODR fix
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
...{cython-3.1.2.ebuild => cython-3.1.2-r1.ebuild} | 2 ++
dev-python/cython/files/cython-3.1.2-odr.patch | 35 ++++++++++++++++++++++
2 files changed, 37 insertions(+)
diff --git a/dev-python/cython/cython-3.1.2.ebuild
b/dev-python/cython/cython-3.1.2-r1.ebuild
similarity index 97%
rename from dev-python/cython/cython-3.1.2.ebuild
rename to dev-python/cython/cython-3.1.2-r1.ebuild
index 20ca38668c26..6145478e6654 100644
--- a/dev-python/cython/cython-3.1.2.ebuild
+++ b/dev-python/cython/cython-3.1.2-r1.ebuild
@@ -39,6 +39,8 @@ BDEPEND="
PATCHES=(
"${FILESDIR}/${PN}-0.29.22-spawn-multiprocessing.patch"
"${FILESDIR}/${PN}-0.29.23-pythran-parallel-install.patch"
+ # https://github.com/cython/cython/pull/6957
+ "${FILESDIR}/${P}-odr.patch"
)
distutils_enable_sphinx docs \
diff --git a/dev-python/cython/files/cython-3.1.2-odr.patch
b/dev-python/cython/files/cython-3.1.2-odr.patch
new file mode 100644
index 000000000000..f5dacc748d7a
--- /dev/null
+++ b/dev-python/cython/files/cython-3.1.2-odr.patch
@@ -0,0 +1,35 @@
+From 269dea7ac6f10566c3b1ea3850f6a45538e998ee Mon Sep 17 00:00:00 2001
+From: Ray Speth <[email protected]>
+Date: Tue, 10 Jun 2025 03:09:03 -0400
+Subject: [PATCH] Mark utility function static to avoid ODR violations (#6957)
+
+PR #6882 introduces a new method `__pyx_CommonTypesMetaclass_get_module`
+in `CommonStructures.c`. Unlike other functions in this file, it is not
+marked `static`, which causes one-definition-rule violations when trying
+to compile multiple `.pyx` files into a single extension module.
+
+For context, this module structure is used in
+[Cantera](https://github.com/Cantera/cantera). We build the combined
+module
+[here](https://github.com/Cantera/cantera/blob/b308592776130d82eaac4949283fc87c031cdc97/interfaces/cython/SConscript#L46-L81),
+and then use a custom "finder" to load the submodules as defined
+[here](https://github.com/Cantera/cantera/blob/main/interfaces/cython/cantera/_cantera.pyx).
+
+Marking this function `static` restores the previous capability.
+---
+ Cython/Utility/CommonStructures.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/Cython/Utility/CommonStructures.c
b/Cython/Utility/CommonStructures.c
+index 94f7cc89066..3f1ce6d8408 100644
+--- a/Cython/Utility/CommonStructures.c
++++ b/Cython/Utility/CommonStructures.c
+@@ -161,7 +161,7 @@ static int __pyx_CommonTypesMetaclass_init(PyObject
*module); /* proto */
+ //@requires: FetchCommonType
+ //@substitute: naming
+
+-PyObject* __pyx_CommonTypesMetaclass_get_module(CYTHON_UNUSED PyObject *self,
CYTHON_UNUSED void* context) {
++static PyObject* __pyx_CommonTypesMetaclass_get_module(CYTHON_UNUSED PyObject
*self, CYTHON_UNUSED void* context) {
+ return PyUnicode_FromString(__PYX_ABI_MODULE_NAME);
+ }
+