[Python-checkins] cpython (3.1): Issue #11569: use absolute path to the sysctl command in multiprocessing to (original) (raw)
ronald.oussoren python-checkins at python.org
Wed Mar 16 14:47:49 CET 2011
- Previous message: [Python-checkins] cpython (merge 3.2 -> default): Merge with 3.2.
- Next message: [Python-checkins] cpython (merge 3.1 -> 3.2): Merge with 3.1
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
http://hg.python.org/cpython/rev/c394f2d42ff8 changeset: 68593:c394f2d42ff8 branch: 3.1 parent: 68590:f2ac5bbc1623 user: Ronald Oussoren <ronaldoussoren at mac.com> date: Wed Mar 16 09:41:32 2011 -0400 summary: 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.
files: Lib/multiprocessing/init.py Misc/ACKS Misc/NEWS
diff --git a/Lib/multiprocessing/init.py b/Lib/multiprocessing/init.py --- a/Lib/multiprocessing/init.py +++ b/Lib/multiprocessing/init.py @@ -115,8 +115,11 @@ 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/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -583,6 +583,7 @@ Joe Norton Neal Norwitz Michal Nowikowski +Steffen Daode Nurpmeso Nigel O'Brian Kevin O'Connor Tim O'Malley diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -40,6 +40,10 @@ Library
+- 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.
-- Repository URL: http://hg.python.org/cpython
- Previous message: [Python-checkins] cpython (merge 3.2 -> default): Merge with 3.2.
- Next message: [Python-checkins] cpython (merge 3.1 -> 3.2): Merge with 3.1
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]