Bug#1058027: pybj: FTBFS with Python 3.12

s3v c0llapsed at yahoo.it
Sat Jan 13 06:52:04 GMT 2024


Dear Maintainer,

Python 3.12 changed recursion mechanism [1]

 sys.setrecursionlimit() and sys.getrecursionlimit(). The recursion limit
 now applies only to Python code. Builtin functions do not use the recursion
 limit, but are protected by a different mechanism that prevents recursion
 from causing a virtual machine crash.

so increasing recursion limit as py-ubjson did [2] makes your package
buildable.
E.g.

--- a/test/test.py
+++ b/test/test.py
@@ -477,10 +477,10 @@
 
     def test_recursion(self):
         old_limit = getrecursionlimit()
-        setrecursionlimit(200)
+        setrecursionlimit(100)
         try:
             obj = current = []
-            for _ in range(getrecursionlimit() * 2):
+            for _ in range(getrecursionlimit() * 30):
                 new_list = []
                 current.append(new_list)
                 current = new_list
@@ -488,7 +488,7 @@
             with self.assert_raises_regex(RuntimeError, 'recursion'):
                 self.bjddumpb(obj)
 
-            raw = ARRAY_START * (getrecursionlimit() * 2)
+            raw = ARRAY_START * (getrecursionlimit() * 30)
             with self.assert_raises_regex(RuntimeError, 'recursion'):
                 self.bjdloadb(raw)
         finally:


Kind Regards

[1] https://docs.python.org/3/whatsnew/3.12.html#sys
[2] https://sources.debian.org/src/py-ubjson/0.16.1-3/debian/patches/py12_recursion_PR19.diff/



More information about the debian-science-maintainers mailing list