From 4eda9429b08ee682e884195da41fb673c393faa9 Mon Sep 17 00:00:00 2001 From: thexai <58434170+thexai@users.noreply.github.com> Date: Sun, 28 Jun 2026 10:29:58 +0200 Subject: [PATCH] gh-152433: Windows: enable mmapmodule for UWP --- .../Windows/2026-06-29-16-29-50.gh-issue-152433._nhCjt.rst | 2 ++ Modules/mmapmodule.c | 4 ++-- PC/config.c | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) create mode 100644 Misc/NEWS.d/next/Windows/2026-06-29-16-29-50.gh-issue-152433._nhCjt.rst diff --git a/Misc/NEWS.d/next/Windows/2026-06-29-16-29-50.gh-issue-152433._nhCjt.rst b/Misc/NEWS.d/next/Windows/2026-06-29-16-29-50.gh-issue-152433._nhCjt.rst new file mode 100644 index 00000000000000..0c420c124c2981 --- /dev/null +++ b/Misc/NEWS.d/next/Windows/2026-06-29-16-29-50.gh-issue-152433._nhCjt.rst @@ -0,0 +1,2 @@ +Restores the ``mmap`` module when CPython is built from source for specific +Windows API sets. diff --git a/Modules/mmapmodule.c b/Modules/mmapmodule.c index 6fb04ba7bd47c6..cbf40365e4f41b 100644 --- a/Modules/mmapmodule.c +++ b/Modules/mmapmodule.c @@ -338,7 +338,7 @@ _PyErr_SetFromNTSTATUS(ULONG status) } #endif -#if defined(MS_WINDOWS) && !defined(DONT_USE_SEH) +#if defined(MS_WINDOWS_DESKTOP) && !defined(DONT_USE_SEH) #define HANDLE_INVALID_MEM(sourcecode) \ do { \ EXCEPTION_RECORD record; \ @@ -364,7 +364,7 @@ do { \ } while (0) #endif -#if defined(MS_WINDOWS) && !defined(DONT_USE_SEH) +#if defined(MS_WINDOWS_DESKTOP) && !defined(DONT_USE_SEH) #define HANDLE_INVALID_MEM_METHOD(self, sourcecode) \ do { \ EXCEPTION_RECORD record; \ diff --git a/PC/config.c b/PC/config.c index 51b46c64d99b81..dcccc6a3a6d016 100644 --- a/PC/config.c +++ b/PC/config.c @@ -140,7 +140,7 @@ struct _inittab _PyImport_Inittab[] = { {"itertools", PyInit_itertools}, {"_collections", PyInit__collections}, {"_symtable", PyInit__symtable}, -#if defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_GAMES) +#if defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_GAMES) || defined(MS_WINDOWS_APP) {"mmap", PyInit_mmap}, #endif {"_csv", PyInit__csv},