]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-152433: Windows: implement ``os.cpu_count()`` for UWP (GH-152479)
authorthexai <58434170+thexai@users.noreply.github.com>
Sat, 18 Jul 2026 12:19:03 +0000 (14:19 +0200)
committerGitHub <noreply@github.com>
Sat, 18 Jul 2026 12:19:03 +0000 (07:19 -0500)
Misc/NEWS.d/next/Windows/2026-06-28-12-37-08.gh-issue-152433.FTMgqF.rst [new file with mode: 0644]
Modules/posixmodule.c

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 (file)
index 0000000..bd295fb
--- /dev/null
@@ -0,0 +1 @@
+Implement :func:`os.cpu_count` for Universal Windows Platform.
index 36debd6fe7aa153578e7f1982566e6c20f617625..4c26ee52279abcd709fa3e0fb071ec80e9093682 100644 (file)
@@ -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)