Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f0edd1b

Browse files
Merge with 3.1
2 parents 2e8a07c + 0b8753d commit f0edd1b

3 files changed

Lines changed: 9 additions & 1 deletion

File tree

Lib/multiprocessing/__init__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,11 @@ def cpu_count():
115115
except (ValueError, KeyError):
116116
num = 0
117117
elif 'bsd' in sys.platform or sys.platform == 'darwin':
118+
comm = '/sbin/sysctl -n hw.ncpu'
119+
if sys.platform == 'darwin':
120+
comm = '/usr' + comm
118121
try:
119-
with os.popen('sysctl -n hw.ncpu') as p:
122+
with os.popen(comm) as p:
120123
num = int(p.read())
121124
except ValueError:
122125
num = 0

Misc/ACKS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -624,6 +624,7 @@ Tim Northover
624624
Joe Norton
625625
Neal Norwitz
626626
Michal Nowikowski
627+
Steffen Daode Nurpmeso
627628
Nigel O'Brian
628629
Kevin O'Connor
629630
Tim O'Malley

Misc/NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ Library
4343
- Issue #11133: fix two cases where inspect.getattr_static can trigger code
4444
execution. Patch by Daniel Urban.
4545

46+
- Issue #11569: use absolute path to the sysctl command in multiprocessing to
47+
ensure that it will be found regardless of the shell PATH. This ensures
48+
that multiprocessing.cpu_count works on default installs of MacOSX.
49+
4650
- Issue #11501: disutils.archive_utils.make_zipfile no longer fails if zlib is
4751
not installed. Instead, the zipfile.ZIP_STORED compression is used to create
4852
the ZipFile. Patch by Natalia B. Bidart.

0 commit comments

Comments
 (0)