From: thexai <58434170+thexai@users.noreply.github.com> Date: Sat, 18 Jul 2026 12:19:03 +0000 (+0200) Subject: gh-152433: Windows: implement ``os.cpu_count()`` for UWP (GH-152479) X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d7b171b6b32c823f28ba974e7c80c4fdfe78c98e;p=thirdparty%2FPython%2Fcpython.git gh-152433: Windows: implement ``os.cpu_count()`` for UWP (GH-152479) --- diff --git a/Misc/NEWS.d/next/Windows/2026-06-28-12-37-08.gh-issue-152433.FTMgqF.rst b/Misc/NEWS.d/next/Windows/2026-06-28-12-37-08.gh-issue-152433.FTMgqF.rst new file mode 100644 index 000000000000..bd295fb4dd60 --- /dev/null +++ b/Misc/NEWS.d/next/Windows/2026-06-28-12-37-08.gh-issue-152433.FTMgqF.rst @@ -0,0 +1 @@ +Implement :func:`os.cpu_count` for Universal Windows Platform. diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index 36debd6fe7aa..4c26ee52279a 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -16003,7 +16003,9 @@ os_cpu_count_impl(PyObject *module) # ifdef MS_WINDOWS_DESKTOP ncpu = GetActiveProcessorCount(ALL_PROCESSOR_GROUPS); # else - ncpu = 0; + SYSTEM_INFO sysinfo; + GetSystemInfo(&sysinfo); + ncpu = sysinfo.dwNumberOfProcessors; # endif #elif defined(__hpux)