Commit 2ab5994d authored by Ronald Oussoren's avatar Ronald Oussoren

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.

Patch by Steffen Daode Nurpmeso.
parent b3f75640
...@@ -116,8 +116,11 @@ def cpu_count(): ...@@ -116,8 +116,11 @@ def cpu_count():
except (ValueError, KeyError): except (ValueError, KeyError):
num = 0 num = 0
elif 'bsd' in sys.platform or sys.platform == 'darwin': elif 'bsd' in sys.platform or sys.platform == 'darwin':
comm = '/sbin/sysctl -n hw.ncpu'
if sys.platform == 'darwin':
comm = '/usr' + comm
try: try:
with os.popen('sysctl -n hw.ncpu') as p: with os.popen(comm) as p:
num = int(p.read()) num = int(p.read())
except ValueError: except ValueError:
num = 0 num = 0
......
...@@ -587,6 +587,7 @@ Tim Northover ...@@ -587,6 +587,7 @@ Tim Northover
Joe Norton Joe Norton
Neal Norwitz Neal Norwitz
Michal Nowikowski Michal Nowikowski
Steffen Daode Nurpmeso
Nigel O'Brian Nigel O'Brian
Kevin O'Connor Kevin O'Connor
Tim O'Malley Tim O'Malley
......
...@@ -43,6 +43,10 @@ Core and Builtins ...@@ -43,6 +43,10 @@ Core and Builtins
Library 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 #11500: Fixed a bug in the os x proxy bypass code for fully qualified - Issue #11500: Fixed a bug in the os x proxy bypass code for fully qualified
IP addresses in the proxy exception list. IP addresses in the proxy exception list.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment