Bug#1076206: pybj: Failure python 3.15rc2
Maximiliano Curia
maxy at debian.org
Wed Sep 9 22:06:22 BST 2026
user debian-python at lists.debian.org
usertags 1076206 python3.15
tags 1076206 patch
thanks
Hi!
While rebuilding the python related packages against the Python 3.15rc2
version I ran into this failure [1].
In order to solve it, I have:
- Dropped the broken numpy dependency
- Updated debian/control to rely on dh-sequence-numpy3 instead of
setting the abi manually
- Backported upstream commit a46355a0: fix pip ext compilation error,
[2] to add include_dirs=[numpy.get_include()] and import numpy in
setup.py.
- Added patch to replace deprecated PyArray_* constants with NPY_*.
- Updated the recursion patch "C extension does not use Python recursion
limit in Python 3.12+"
I've applied these fixes in the sandbox [3] to verify that it builds
successfully and that the extension is present in the result. These
fixes should be applied in Debian to get the package back to a healthy
state.
Happy hacking,
[1]: https://debusine.debian.net/debian/r-python-python3.15/artifact/TODO/
[2]: https://github.com/NeuroJSON/pybj/commit/a46355a0b0df0bec1817b04368a5a573358645ef
[3]: https://debusine.debian.net/debian/r-python-python3.15/
--
"Can you imagine what I would do if I could do all I can?" -- Sun Tzu
Saludos /\/\ /\ >< `/
-------------- next part --------------
diff -Nru pybj-0.2.6/debian/changelog pybj-0.2.6/debian/changelog
--- pybj-0.2.6/debian/changelog 2024-01-21 21:44:44.000000000 +0100
+++ pybj-0.2.6/debian/changelog 2026-09-09 16:53:12.000000000 +0200
@@ -1,3 +1,16 @@
+pybj (0.2.6-2.1) UNRELEASED; urgency=medium
+
+ * Non-maintainer upload.
+ * Update packaging to rely on dh-sequence-numpy3
+ * Add patch backporting upstream commit a46355a0:
+ 0002-fix-pip-ext-compilation-error.patch
+ * Add patch to replace deprecated PyArray_* constants with NPY_*.
+ 0003-numpy2-support.patch
+ * Update the recursion patch as C extensions do not use the recursion limit
+ for Py 3.12+.
+
+ -- Maximiliano Curia <maxy at debian.org> Wed, 09 Sep 2026 16:53:12 +0200
+
pybj (0.2.6-2) unstable; urgency=medium
* Team upload.
diff -Nru pybj-0.2.6/debian/control pybj-0.2.6/debian/control
--- pybj-0.2.6/debian/control 2024-01-21 21:44:44.000000000 +0100
+++ pybj-0.2.6/debian/control 2026-09-09 16:53:12.000000000 +0200
@@ -7,6 +7,7 @@
cython3,
debhelper-compat (= 13),
dh-python,
+ dh-sequence-numpy3,
python3-all,
python3-all-dev,
python3-numpy,
@@ -21,7 +22,7 @@
Package: python3-bjdata
Architecture: any
-Depends: python3-numpy (>= 1:1.11.0~), python3-numpy-abi9, python3, ${misc:Depends}, ${python3:Depends}, ${shlibs:Depends},
+Depends: ${misc:Depends}, ${python3:Depends}, ${shlibs:Depends}
Description: Binary JData (BJData) encoder/decoder for python 3
The BJData spec is derived from the Universal Binary JSON (UBJSON,
http://ubjson.org) specification (Draft 12) developed by Riyad Kalla and
diff -Nru pybj-0.2.6/debian/patches/0001-Python-3.12-changed-recursion-mechanism-1.patch pybj-0.2.6/debian/patches/0001-Python-3.12-changed-recursion-mechanism-1.patch
--- pybj-0.2.6/debian/patches/0001-Python-3.12-changed-recursion-mechanism-1.patch 2024-01-21 21:44:44.000000000 +0100
+++ pybj-0.2.6/debian/patches/0001-Python-3.12-changed-recursion-mechanism-1.patch 2026-09-09 16:53:12.000000000 +0200
@@ -16,16 +16,18 @@
Origin: https://bugs.debian.org/1058027#10
Forwarded: https://github.com/fangq/pybj/pull/1
---
- test/test.py | 6 +++---
- 1 file changed, 3 insertions(+), 3 deletions(-)
+ test/test.py | 8 +++++---
+ 1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/test/test.py b/test/test.py
-index 9f92ab2..dd21206 100644
+index 9f92ab2..b56f8f5 100644
--- a/test/test.py
+++ b/test/test.py
-@@ -477,10 +477,10 @@ class TestEncodeDecodePlain(TestCase): # pylint: disable=too-many-public-method
+@@ -477,10 +477,12 @@ class TestEncodeDecodePlain(TestCase): # pylint: disable=too-many-public-method
def test_recursion(self):
++ if self.__class__.__name__.endswith('Ext') and version_info >= (3, 12):
++ self.skipTest('C extension does not use Python recursion limit in Python 3.12+')
old_limit = getrecursionlimit()
- setrecursionlimit(200)
+ setrecursionlimit(100)
@@ -36,7 +38,7 @@
new_list = []
current.append(new_list)
current = new_list
-@@ -488,7 +488,7 @@ class TestEncodeDecodePlain(TestCase): # pylint: disable=too-many-public-method
+@@ -488,7 +490,7 @@ class TestEncodeDecodePlain(TestCase): # pylint: disable=too-many-public-method
with self.assert_raises_regex(RuntimeError, 'recursion'):
self.bjddumpb(obj)
diff -Nru pybj-0.2.6/debian/patches/0002-fix-pip-ext-compilation-error.patch pybj-0.2.6/debian/patches/0002-fix-pip-ext-compilation-error.patch
--- pybj-0.2.6/debian/patches/0002-fix-pip-ext-compilation-error.patch 1970-01-01 01:00:00.000000000 +0100
+++ pybj-0.2.6/debian/patches/0002-fix-pip-ext-compilation-error.patch 2026-09-09 16:53:12.000000000 +0200
@@ -0,0 +1,29 @@
+From: Qianqian Fang <fangqq at gmail.com>
+Date: Wed, 25 May 2022 12:11:07 -0400
+Subject: fix pip ext compilation error, thanks to @termanis, Iotic-Labs/py-ubjson#16
+
+Origin: backport, https://github.com/fangq/pybj/commit/a46355a0b0df0bec1817b04368a5a573358645ef
+---
+ setup.py | 2 ++
+ 1 file changed, 2 insertions(+)
+
+Index: pybj/setup.py
+===================================================================
+--- pybj.orig/setup.py
++++ pybj/setup.py
+@@ -20,6 +20,7 @@ import os
+ import warnings
+ from glob import glob
+ from platform import python_implementation
++import numpy
+
+ # Allow for environments without setuptools
+ try:
+@@ -95,6 +96,7 @@ setup(
+ ext_modules=([Extension(
+ '_bjdata',
+ sorted(glob('src/*.c')),
++ include_dirs=[numpy.get_include()],
+ extra_compile_args=COMPILE_ARGS,
+ # undef_macros=['NDEBUG']
+ )] if BUILD_EXTENSIONS else []),
diff -Nru pybj-0.2.6/debian/patches/0003-numpy2-support.patch pybj-0.2.6/debian/patches/0003-numpy2-support.patch
--- pybj-0.2.6/debian/patches/0003-numpy2-support.patch 1970-01-01 01:00:00.000000000 +0100
+++ pybj-0.2.6/debian/patches/0003-numpy2-support.patch 2026-09-09 16:53:12.000000000 +0200
@@ -0,0 +1,67 @@
+From: Maximiliano Curia <maxy at debian.org>
+Date: Wed, 9 Sep 2026 16:30:00 +0200
+Subject: Use NPY_ type constants for NumPy 2.x compatibility
+
+Replace deprecated PyArray_ type constants with NPY_ enum constants.
+---
+ src/decoder.c | 24 ++++++++++++------------
+ 1 file changed, 12 insertions(+), 12 deletions(-)
+
+Index: pybj/src/decoder.c
+===================================================================
+--- pybj.orig/src/decoder.c
++++ pybj/src/decoder.c
+@@ -774,41 +774,41 @@ static int _get_type_info(char type, int
+ switch (type) {
+ case TYPE_FLOAT16:
+ *bytelen=2;
+- return PyArray_HALF;
++ return NPY_HALF;
+ case TYPE_FLOAT32:
+ *bytelen=4;
+- return PyArray_FLOAT;
++ return NPY_FLOAT;
+ case TYPE_FLOAT64:
+ *bytelen=8;
+- return PyArray_DOUBLE;
++ return NPY_DOUBLE;
+ case TYPE_INT8:
+ *bytelen=1;
+- return PyArray_BYTE;
++ return NPY_BYTE;
+ case TYPE_UINT8:
+ *bytelen=1;
+- return PyArray_UBYTE;
++ return NPY_UBYTE;
+ case TYPE_INT16:
+ *bytelen=2;
+- return PyArray_SHORT;
++ return NPY_SHORT;
+ case TYPE_UINT16:
+ *bytelen=2;
+- return PyArray_USHORT;
++ return NPY_USHORT;
+ case TYPE_INT32:
+ *bytelen=4;
+- return PyArray_LONG;
++ return NPY_INT;
+ case TYPE_UINT32:
+ *bytelen=4;
+- return PyArray_ULONG;
++ return NPY_UINT;
+ case TYPE_INT64:
+ *bytelen=8;
+- return PyArray_LONGLONG;
++ return NPY_LONGLONG;
+ case TYPE_UINT64:
+ *bytelen=8;
+- return PyArray_ULONGLONG;
++ return NPY_ULONGLONG;
+ default:
+ *bytelen=0;
+ PyErr_SetString(PyExc_RuntimeError, "Internal error - _get_type_info");
+- return PyArray_USERDEF;
++ return NPY_USERDEF;
+ }
+ }
+
diff -Nru pybj-0.2.6/debian/patches/series pybj-0.2.6/debian/patches/series
--- pybj-0.2.6/debian/patches/series 2024-01-21 21:44:44.000000000 +0100
+++ pybj-0.2.6/debian/patches/series 2026-09-09 16:53:12.000000000 +0200
@@ -1 +1,3 @@
0001-Python-3.12-changed-recursion-mechanism-1.patch
+0002-fix-pip-ext-compilation-error.patch
+0003-numpy2-support.patch
More information about the debian-science-maintainers
mailing list