summaryrefslogtreecommitdiffstats
path: root/Lib/multiprocessing/pool.py
diff options
context:
space:
mode:
authorCharles-François Natali <cf.natali@gmail.com>2013-06-28 17:25:45 (GMT)
committerCharles-François Natali <cf.natali@gmail.com>2013-06-28 17:25:45 (GMT)
commit37cfb0a920bd01ee81ce7bebebfe510d01d751d6 (patch)
treefdbb1f0eee3f4f5addd815279af456aa686dccf5 /Lib/multiprocessing/pool.py
parentc723da361a8d5129ec9bd336e6327a65b4e92148 (diff)
downloadcpython-37cfb0a920bd01ee81ce7bebebfe510d01d751d6.zip
cpython-37cfb0a920bd01ee81ce7bebebfe510d01d751d6.tar.gz
cpython-37cfb0a920bd01ee81ce7bebebfe510d01d751d6.tar.bz2
Issue #17914: Use os.cpu_count() instead of multiprocessing.cpu_count() where
applicable.
Diffstat (limited to 'Lib/multiprocessing/pool.py')
-rw-r--r--Lib/multiprocessing/pool.py8
1 files changed, 3 insertions, 5 deletions
diff --git a/Lib/multiprocessing/pool.py b/Lib/multiprocessing/pool.py
index bcf8a37..8082ad6 100644
--- a/Lib/multiprocessing/pool.py
+++ b/Lib/multiprocessing/pool.py
@@ -17,10 +17,11 @@ import threading
import queue
import itertools
import collections
+import os
import time
import traceback
-from multiprocessing import Process, cpu_count, TimeoutError
+from multiprocessing import Process, TimeoutError
from multiprocessing.util import Finalize, debug
#
@@ -147,10 +148,7 @@ class Pool(object):
self._initargs = initargs
if processes is None:
- try:
- processes = cpu_count()
- except NotImplementedError:
- processes = 1
+ processes = os.cpu_count() or 1
if processes < 1:
raise ValueError("Number of processes must be at least 1")