diff options
author | Victor Stinner <vstinner@python.org> | 2023-09-30 22:12:51 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-30 22:12:51 (GMT) |
commit | c81521020d643b4a5183098470ef7e6470facefb (patch) | |
tree | 9679b712dd9f4bfa003d6c8a0b188d34cf015025 /Modules/clinic/posixmodule.c.h | |
parent | 2c234196ea30b9da370780204ed9068f1fb134c6 (diff) | |
download | cpython-c81521020d643b4a5183098470ef7e6470facefb.zip cpython-c81521020d643b4a5183098470ef7e6470facefb.tar.gz cpython-c81521020d643b4a5183098470ef7e6470facefb.tar.bz2 |
gh-109649: Add os.process_cpu_count() function (#109907)
* Refactor os_sched_getaffinity_impl(): move variable definitions to
their first assignment.
* Fix test_posix.test_sched_getaffinity(): restore the old CPU mask
when the test completes!
* Doc: Specify that os.cpu_count() counts *logicial* CPUs.
* Doc: Specify that os.sched_getaffinity(0) is related to the calling
thread.
Diffstat (limited to 'Modules/clinic/posixmodule.c.h')
-rw-r--r-- | Modules/clinic/posixmodule.c.h | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/Modules/clinic/posixmodule.c.h b/Modules/clinic/posixmodule.c.h index e77a31b..fc39ab7 100644 --- a/Modules/clinic/posixmodule.c.h +++ b/Modules/clinic/posixmodule.c.h @@ -10425,11 +10425,9 @@ PyDoc_STRVAR(os_cpu_count__doc__, "cpu_count($module, /)\n" "--\n" "\n" -"Return the number of CPUs in the system; return None if indeterminable.\n" +"Return the number of logical CPUs in the system.\n" "\n" -"This number is not equivalent to the number of CPUs the current process can\n" -"use. The number of usable CPUs can be obtained with\n" -"``len(os.sched_getaffinity(0))``"); +"Return None if indeterminable."); #define OS_CPU_COUNT_METHODDEF \ {"cpu_count", (PyCFunction)os_cpu_count, METH_NOARGS, os_cpu_count__doc__}, @@ -11988,4 +11986,4 @@ exit: #ifndef OS_WAITSTATUS_TO_EXITCODE_METHODDEF #define OS_WAITSTATUS_TO_EXITCODE_METHODDEF #endif /* !defined(OS_WAITSTATUS_TO_EXITCODE_METHODDEF) */ -/*[clinic end generated code: output=51aa26bc6a41e1da input=a9049054013a1b77]*/ +/*[clinic end generated code: output=8b60de6ddb925bc3 input=a9049054013a1b77]*/ |