Skip to content

Commit

Permalink
BUG: use ThreadPoolExecutor instead of ThreadPool
Browse files Browse the repository at this point in the history
Use `concurrent.futures.ThreadPoolExecutor` in distutils
instead of `multiprocessing.pool.ThreadPool`.

Fix numpy#21026
  • Loading branch information
GalaxySnail authored and melissawm committed Apr 12, 2022
1 parent 55affcb commit f2a965c
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions numpy/distutils/ccompiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,10 +355,9 @@ def single_compile(args):

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:
Expand Down

0 comments on commit f2a965c

Please sign in to comment.