summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRonald Oussoren <ronaldoussoren@mac.com>2011-03-16 13:44:26 (GMT)
committerRonald Oussoren <ronaldoussoren@mac.com>2011-03-16 13:44:26 (GMT)
commit4d5fe33a7067310cca80351377c17712e4bd1360 (patch)
treecd48cd6b2e61b202ab73dcd68041d8495df30c07
parente371ad65f317c7bcf3355111ca08652254798f82 (diff)
parentf0edd1b86d1572c0fe9cc31b5aaadc12ea75f7f0 (diff)
downloadcpython-4d5fe33a7067310cca80351377c17712e4bd1360.zip
cpython-4d5fe33a7067310cca80351377c17712e4bd1360.tar.gz
cpython-4d5fe33a7067310cca80351377c17712e4bd1360.tar.bz2
Merge with 3.2
-rw-r--r--Lib/multiprocessing/__init__.py5
-rw-r--r--Misc/NEWS4
2 files changed, 8 insertions, 1 deletions
diff --git a/Lib/multiprocessing/__init__.py b/Lib/multiprocessing/__init__.py
index adad630..deb031c 100644
--- a/Lib/multiprocessing/__init__.py
+++ b/Lib/multiprocessing/__init__.py
@@ -115,8 +115,11 @@ def cpu_count():
except (ValueError, KeyError):
num = 0
elif 'bsd' in sys.platform or sys.platform == 'darwin':
+ comm = '/sbin/sysctl -n hw.ncpu'
+ if sys.platform == 'darwin':
+ comm = '/usr' + comm
try:
- with os.popen('sysctl -n hw.ncpu') as p:
+ with os.popen(comm) as p:
num = int(p.read())
except ValueError:
num = 0
diff --git a/Misc/NEWS b/Misc/NEWS
index 77ee79c..88334df 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -75,6 +75,10 @@ Library
- Issue #11133: fix two cases where inspect.getattr_static can trigger code
execution. Patch by Daniel Urban.
+- Issue #11569: use absolute path to the sysctl command in multiprocessing to
+ ensure that it will be found regardless of the shell PATH. This ensures
+ that multiprocessing.cpu_count works on default installs of MacOSX.
+
- Issue #11501: disutils.archive_utils.make_zipfile no longer fails if zlib is
not installed. Instead, the zipfile.ZIP_STORED compression is used to create
the ZipFile. Patch by Natalia B. Bidart.