diff options
| author | GalaxySnail <ylc991@163.com> | 2022-02-10 10:28:32 +0800 |
|---|---|---|
| committer | GalaxySnail <ylc991@163.com> | 2022-02-10 10:36:31 +0800 |
| commit | 204f9318e5d32a3616913d0d4f16e6c63efb6ce8 (patch) | |
| tree | b2de4f9e3a1715a6b8a21c80a69421ca75248993 /numpy/distutils | |
| parent | d7929b3722815eb261fba7ca03acf4f0d8d5f78e (diff) | |
| download | numpy-204f9318e5d32a3616913d0d4f16e6c63efb6ce8.tar.gz | |
BUG: use ThreadPoolExecutor instead of ThreadPool
Use `concurrent.futures.ThreadPoolExecutor` in distutils
instead of `multiprocessing.pool.ThreadPool`.
Fix #21026
Diffstat (limited to 'numpy/distutils')
| -rw-r--r-- | numpy/distutils/ccompiler.py | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/numpy/distutils/ccompiler.py b/numpy/distutils/ccompiler.py index 16f00d8ed..74e2c51f6 100644 --- a/numpy/distutils/ccompiler.py +++ b/numpy/distutils/ccompiler.py @@ -355,10 +355,9 @@ def CCompiler_compile(self, sources, output_dir=None, macros=None, if len(build) > 1 and jobs > 1: # build parallel - import multiprocessing.pool - pool = multiprocessing.pool.ThreadPool(jobs) - pool.map(single_compile, build_items) - pool.close() + from concurrent.futures import ThreadPoolExecutor + with ThreadPoolExecutor(jobs) as pool: + pool.map(single_compile, build_items) else: # build serial for o in build_items: |
