From d96aa519fb4be59ec38dc6860ea31d6879e05fd4 Mon Sep 17 00:00:00 2001 From: thexai <58434170+thexai@users.noreply.github.com> Date: Sun, 28 Jun 2026 12:20:19 +0200 Subject: [PATCH] gh-152433: Windows: implement os.cpu_count() for UWP --- .../Windows/2026-06-28-12-37-08.gh-issue-152433.FTMgqF.rst | 1 + Modules/posixmodule.c | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 Misc/NEWS.d/next/Windows/2026-06-28-12-37-08.gh-issue-152433.FTMgqF.rst 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 000000000000000..8a9f2bd38aec796 --- /dev/null +++ b/Misc/NEWS.d/next/Windows/2026-06-28-12-37-08.gh-issue-152433.FTMgqF.rst @@ -0,0 +1 @@ +Implement os.cpu_count() for UWP. diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index c52d2e7d5bfbd9f..f5caab35e8798cb 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -15990,7 +15990,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)