cpython: a85ac58e9eaf (original) (raw)
Mercurial > cpython
changeset 83864:a85ac58e9eaf
Issue #17914: Remove OS-X special-case, and use the correct int type. [#17914]
Charles-Francois Natali cf.natali@gmail.com | |
---|---|
date | Mon, 20 May 2013 17:31:06 +0200 |
parents | e47806951fb2 |
children | f9d815522cdb |
files | Modules/posixmodule.c |
diffstat | 1 files changed, 6 insertions(+), 9 deletions(-)[+] [-] Modules/posixmodule.c 15 |
line wrap: on
line diff
--- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -10324,12 +10324,12 @@ established."); defined(FreeBSD) || [](#l1.4) defined(NetBSD) || [](#l1.5) defined(APPLE) -static long +static int _bsd_cpu_count(void) {
mib[0] = CTL_HW; mib[1] = HW_NCPU; @@ -10343,7 +10343,7 @@ static long static PyObject * posix_cpu_count(PyObject *self) {
#ifdef MS_WINDOWS SYSTEM_INFO sysinfo; GetSystemInfo(&sysinfo); @@ -10352,14 +10352,11 @@ posix_cpu_count(PyObject *self) ncpu = mpctl(MPC_GETNUMSPUS, NULL, NULL); #elif defined(HAVE_SYSCONF) && defined(_SC_NPROCESSORS_ONLN) ncpu = sysconf(_SC_NPROCESSORS_ONLN); -#elif defined(APPLE)
- size_t len = sizeof(int);
- if (sysctlnametomib("hw.logicalcpu", &ncpu, &len, NULL, 0) != 0)
ncpu = _bsd_cpu_count();[](#l1.35)
#elif defined(DragonFly) || [](#l1.36) defined(OpenBSD) || [](#l1.37) defined(FreeBSD) || [](#l1.38)
defined(__NetBSD__)[](#l1.39)