From e0e02b18b36f16de60bfc3d60b49b10e28f62aac 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 e455f532a5bbf41..5ccc359add90816 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -16008,7 +16008,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)