File: py314-avoid-multiprocessing-forkserver.patch

package info (click to toggle)
python-iniparse 0.5.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 324 kB
  • sloc: python: 2,219; makefile: 24; sh: 8
file content (52 lines) | stat: -rw-r--r-- 1,896 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
From: Karolina Surma <ksurma@redhat.com>
Date: Wed, 12 Mar 2025 14:46:09 +0100
Subject: Avoid the multiprocessing forkserver method

From Python 3.14 on, the default method of spawning processes on
non-macOS POSIX systems has been changed from fork to forkserver.
Ensure the correct method is used in the test.

Origin: upstream, https://github.com/candlepin/python-iniparse/pull/38
Bug-Debian: https://bugs.debian.org/1123527
Last-Update: 2026-01-01
---
 tests/test_multiprocessing.py | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/tests/test_multiprocessing.py b/tests/test_multiprocessing.py
index 44a891b..01a5a0c 100644
--- a/tests/test_multiprocessing.py
+++ b/tests/test_multiprocessing.py
@@ -1,6 +1,6 @@
 import unittest
 try:
-    from multiprocessing import Process, Queue, Pipe
+    from multiprocessing import Process, Queue, Pipe, get_start_method, get_context
     disabled = False
 except ImportError:
     Process = None
@@ -14,6 +14,16 @@ from iniparse import ini
 class TestIni(unittest.TestCase):
     """Test sending INIConfig objects."""
 
+    # Since Python 3.14 on non-macOS POSIX systems
+    # the default method has been changed to forkserver.
+    # The code in this module does not work with it,
+    # hence the explicit change to 'fork'
+    # See https://github.com/python/cpython/issues/125714
+    if get_start_method() == "forkserver":
+        _mp_context = get_context(method="fork")
+    else:
+        _mp_context = get_context()
+
     def test_queue(self):
         def getxy(_q, _w):
             _cfg = _q.get_nowait()
@@ -23,6 +33,6 @@ class TestIni(unittest.TestCase):
         q = Queue()
         w = Queue()
         q.put(cfg)
-        p = Process(target=getxy, args=(q, w))
+        p = self._mp_context.Process(target=getxy, args=(q, w))
         p.start()
         self.assertEqual(w.get(timeout=1), '42')