File: py314-multicore.patch

package info (click to toggle)
python-easydev 0.13.3%2Bdfsg1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 652 kB
  • sloc: python: 1,904; makefile: 116; javascript: 49
file content (45 lines) | stat: -rw-r--r-- 1,356 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
From: Colin Watson <cjwatson@debian.org>
Date: Tue, 6 Jan 2026 12:38:19 +0000
Subject: Fix multicore tests on Python 3.14

The pool initializer function must be pickleable.

Forwarded: https://github.com/cokelaer/easydev/pull/40
Bug-Debian: https://bugs.debian.org/1123235
Last-Update: 2026-01-06
---
 easydev/multicore.py | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/easydev/multicore.py b/easydev/multicore.py
index c977525..c64c0b9 100644
--- a/easydev/multicore.py
+++ b/easydev/multicore.py
@@ -19,6 +19,12 @@ from multiprocessing import Pool, Process, Queue, cpu_count
 __all__ = ["MultiProcessing"]
 
 
+def _init_worker():
+    import signal
+
+    signal.signal(signal.SIGINT, signal.SIG_IGN)
+
+
 class MultiProcessing(object):
     """Class to run jobs in an asynchronous manner.
 
@@ -102,13 +108,8 @@ class MultiProcessing(object):
             self.pb = Progress(len(self.jobs), 1)
             self.pb.animate(0)
 
-        def init_worker():
-            import signal
-
-            signal.signal(signal.SIGINT, signal.SIG_IGN)
-
         self.results = []
-        self.pool = Pool(self.maxcpu, init_worker)
+        self.pool = Pool(self.maxcpu, _init_worker)
 
         for process in self.jobs:
             self.pool.apply_async(process._target, process._args, process._kwargs, callback=self._cb)