mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
Issue #17914: Use os.cpu_count() instead of multiprocessing.cpu_count() where
applicable.
This commit is contained in:
parent
c723da361a
commit
37cfb0a920
4 changed files with 7 additions and 13 deletions
|
@ -508,12 +508,8 @@ def main(tests=None, testdir=None, verbose=0, quiet=False,
|
|||
elif o in ('-j', '--multiprocess'):
|
||||
use_mp = int(a)
|
||||
if use_mp <= 0:
|
||||
try:
|
||||
import multiprocessing
|
||||
# Use all cores + extras for tests that like to sleep
|
||||
use_mp = 2 + multiprocessing.cpu_count()
|
||||
except (ImportError, NotImplementedError):
|
||||
use_mp = 3
|
||||
# Use all cores + extras for tests that like to sleep
|
||||
use_mp = 2 + (os.cpu_count() or 1)
|
||||
if use_mp == 1:
|
||||
use_mp = None
|
||||
elif o == '--header':
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue