blob: 0aa7212b9a342c5b94d2fcc0752726c20e885cdb [file] [log] [blame]
Needed to prevent a loop while calling cythonize on macOS - or any platform
defaulting to the 'spawn' method, as Python 3.8 does on Darwin.
https://github.com/cython/cython/pull/3263
From 15ae78bb74a856836dd64828326f4f0812d36520 Mon Sep 17 00:00:00 2001
From: Marcel Bargull <marcel.bargull@udo.edu>
Date: Fri, 6 Dec 2019 18:21:19 +0100
Subject: [PATCH] Disable parallel cythonization for "spawn" start method.
---
Cython/Build/Dependencies.py | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/Cython/Build/Dependencies.py b/Cython/Build/Dependencies.py
index 593e00a6ef..f9b9c15bc5 100644
--- a/Cython/Build/Dependencies.py
+++ b/Cython/Build/Dependencies.py
@@ -1073,6 +1073,11 @@ def copy_to_build_dir(filepath, root=os.getcwd()):
if N <= 1:
nthreads = 0
+ if nthreads:
+ import multiprocessing
+ if multiprocessing.get_start_method() == 'spawn':
+ print('Disabling parallel cythonization for "spawn" process start method.')
+ nthreads = 0
if nthreads:
import multiprocessing
pool = multiprocessing.Pool(