diff --git a/Doc/library/multiprocessing.rst b/Doc/library/multiprocessing.rst index e109b1ebe1cee4..415d31ccd3633b 100644 --- a/Doc/library/multiprocessing.rst +++ b/Doc/library/multiprocessing.rst @@ -948,7 +948,7 @@ Miscellaneous Return the number of CPUs in the system. This number is not equivalent to the number of CPUs the current process can - use. The number of usable CPUs can be obtained with + use. On some Unix platforms, the number of usable CPUs can be obtained with ``len(os.sched_getaffinity(0))`` May raise :exc:`NotImplementedError`. diff --git a/Doc/library/os.rst b/Doc/library/os.rst index 371d59e9c31a45..1e5325166056ec 100644 --- a/Doc/library/os.rst +++ b/Doc/library/os.rst @@ -4691,7 +4691,7 @@ Miscellaneous System Information Return the number of CPUs in the system. Returns ``None`` if undetermined. This number is not equivalent to the number of CPUs the current process can - use. The number of usable CPUs can be obtained with + use. On some Unix platforms, the number of usable CPUs can be obtained with ``len(os.sched_getaffinity(0))`` diff --git a/Misc/NEWS.d/next/Documentation/2021-04-17-18-04-34.bpo-43881.99JWsY.rst b/Misc/NEWS.d/next/Documentation/2021-04-17-18-04-34.bpo-43881.99JWsY.rst new file mode 100644 index 00000000000000..9ce59da56cda97 --- /dev/null +++ b/Misc/NEWS.d/next/Documentation/2021-04-17-18-04-34.bpo-43881.99JWsY.rst @@ -0,0 +1 @@ +Add platform availabity information for :func:`os.sched_getaffinity` where its usage is recommended. \ No newline at end of file diff --git a/Modules/clinic/posixmodule.c.h b/Modules/clinic/posixmodule.c.h index 36bb7c3ee2e300..b0bbd42c68e86b 100644 --- a/Modules/clinic/posixmodule.c.h +++ b/Modules/clinic/posixmodule.c.h @@ -7947,7 +7947,7 @@ PyDoc_STRVAR(os_cpu_count__doc__, "Return the number of CPUs in the system; return None if indeterminable.\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" +"use. On some Unix platforms, the number of usable CPUs can be obtained with\n" "``len(os.sched_getaffinity(0))``"); #define OS_CPU_COUNT_METHODDEF \ diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index 65e8d5e7bd984d..8fd7a493f8615e 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -13175,7 +13175,7 @@ os.cpu_count Return the number of CPUs in the system; return None if indeterminable. This number is not equivalent to the number of CPUs the current process can -use. The number of usable CPUs can be obtained with +use. On some Unix platforms, the number of usable CPUs can be obtained with ``len(os.sched_getaffinity(0))`` [clinic start generated code]*/