Skip to contentSkip to conversation

package/python-numpy: fix build with python-cython >= 3.1

PATCH Applied Sébastien Szymanski 2 participants 3 messages Aug 14, 2025 – Aug 21, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/python-numpy: fix build with python-cython >= 3.1

Since commit b536caaec0d8 ("package/python-cython: bump to version 3.1.2"), python-numpy fails to build:

Error compiling Cython file:
------------------------------------------------------------
...
np.issubdtype(cov.dtype, np.complexfloating)):
raise TypeError("mean and cov must not be complex")
if size is None:
shape = []
elif isinstance(size, (int, long, np.integer)):
^
------------------------------------------------------------
numpy/random/_generator.pyx:3760:36: undeclared name not builtin: long

Backport upstream patch to fix that build failure.

---
Backport to: 2025.05.x, 2025.02.x

---
 .../0001-MNT-do-not-use-long-type.patch            | 34 ++++++++++++++++++++++
 1 file changed, 34 insertions(+)
package/python-numpy/0001-MNT-do-not-use-long-type.patch new file +34 -0
new file mode 100644
index 0000000000000000000000000000000000000000..d813a4d51b2690d57454fc0d47090f6bb4751881
@@ -0,0 +1,34 @@
+From 6dc2fd31f8a5a4ef502cb7734f004f5bce94e671 Mon Sep 17 00:00:00 2001
+From: Thomas A Caswell <[email protected]>
+Date: Sat, 18 Nov 2023 16:46:52 -0500
+Subject: [PATCH] MNT: do not use `long` type
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Removed as type at language level 3 in ed7e95912b6ed7d20e190fbf1aecb9f2a997d479
+in cython
+
+Upstream: https://github.com/numpy/numpy/commit/6dc2fd31f8a5a4ef502cb7734f004f5bce94e671
+
+Signed-off-by: Sébastien Szymanski <[email protected]>
+---
+ numpy/random/_generator.pyx | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/numpy/random/_generator.pyx b/numpy/random/_generator.pyx
+index d067e795eb5c..ae481d69d696 100644
+--- a/numpy/random/_generator.pyx
++++ b/numpy/random/_generator.pyx
+@@ -3757,7 +3757,7 @@ def multivariate_normal(self, mean, cov, size=None, check_valid='warn',
+ 
+         if size is None:
+             shape = []
+-        elif isinstance(size, (int, long, np.integer)):
++        elif isinstance(size, (int, np.integer)):
+             shape = [size]
+         else:
+             shape = size
+-- 
+2.49.1
+

---
base-commit: a62ed63dce9a892b5c4942e0c2fc2c310c62ccf6
change-id: 20250814-python-numpy-fix-build-cyhton-dc13dcd4a3e8

Best regards,

Signature · 6 lines
Sébastien Szymanski <[email protected]>

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw
Quoted 15 lines · Sébastien Szymanski

Since commit b536caaec0d8 ("package/python-cython: bump to version 3.1.2"), python-numpy fails to build:

Error compiling Cython file:
------------------------------------------------------------
...
np.issubdtype(cov.dtype, np.complexfloating)):
raise TypeError("mean and cov must not be complex")
if size is None:
shape = []
elif isinstance(size, (int, long, np.integer)):
^
------------------------------------------------------------
numpy/random/_generator.pyx:3760:36: undeclared name not builtin: long

Quoted 3 lines

Backport upstream patch to fix that build failure.

Applied to master, thanks.
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#2 lore raw
In reply to Sébastien Szymanski

In reply of:

Quoted 15 lines

Since commit b536caaec0d8 ("package/python-cython: bump to version 3.1.2"), python-numpy fails to build:

Error compiling Cython file:
------------------------------------------------------------
...
np.issubdtype(cov.dtype, np.complexfloating)):
raise TypeError("mean and cov must not be complex")
if size is None:
shape = []
elif isinstance(size, (int, long, np.integer)):
^
------------------------------------------------------------
numpy/random/_generator.pyx:3760:36: undeclared name not builtin: long

Quoted 3 lines

Backport upstream patch to fix that build failure.

Applied to 2025.02.x & 2025.05.x. Thanks

Quoted 51 lines

---
Backport to: 2025.05.x, 2025.02.x

---
 .../0001-MNT-do-not-use-long-type.patch            | 34 ++++++++++++++++++++++
 1 file changed, 34 insertions(+)
package/python-numpy/0001-MNT-do-not-use-long-type.patch new file +34 -1
new file mode 100644
index 0000000000000000000000000000000000000000..d813a4d51b2690d57454fc0d47090f6bb4751881
@@ -0,0 +1,34 @@
+From 6dc2fd31f8a5a4ef502cb7734f004f5bce94e671 Mon Sep 17 00:00:00 2001
+From: Thomas A Caswell <[email protected]>
+Date: Sat, 18 Nov 2023 16:46:52 -0500
+Subject: [PATCH] MNT: do not use `long` type
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Removed as type at language level 3 in ed7e95912b6ed7d20e190fbf1aecb9f2a997d479
+in cython
+
+Upstream: https://github.com/numpy/numpy/commit/6dc2fd31f8a5a4ef502cb7734f004f5bce94e671
+
+Signed-off-by: Sébastien Szymanski <[email protected]>
+---
+ numpy/random/_generator.pyx | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/numpy/random/_generator.pyx b/numpy/random/_generator.pyx
+index d067e795eb5c..ae481d69d696 100644
+--- a/numpy/random/_generator.pyx
++++ b/numpy/random/_generator.pyx
+@@ -3757,7 +3757,7 @@ def multivariate_normal(self, mean, cov, size=None, check_valid='warn',
+ 
+         if size is None:
+             shape = []
+-        elif isinstance(size, (int, long, np.integer)):
++        elif isinstance(size, (int, np.integer)):
+             shape = [size]
+         else:
+             shape = size
+-- 
+2.49.1
+
 
---

base-commit: a62ed63dce9a892b5c4942e0c2fc2c310c62ccf6
change-id: 20250814-python-numpy-fix-build-cyhton-dc13dcd4a3e8

Quoted 8 lines

Best regards,

Signature · 6 lines
Sébastien Szymanski <[email protected]>

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot