]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-46176: mmap module adding MAP_STACK constant. (GH-30252)
authorDavid CARLIER <devnexen@gmail.com>
Wed, 29 Dec 2021 13:52:29 +0000 (13:52 +0000)
committerGitHub <noreply@github.com>
Wed, 29 Dec 2021 13:52:29 +0000 (22:52 +0900)
Doc/library/mmap.rst
Misc/NEWS.d/next/Library/2021-12-25-11-11-21.bpo-46176.EOY9wd.rst [new file with mode: 0644]
Modules/mmapmodule.c

index c1ebd80abd977bb94aee12b59ee2c0dc132a70c4..d19580cd7ee5ce253f5b011ea2778ec2987e71c3 100644 (file)
@@ -367,8 +367,12 @@ MAP_* Constants
           MAP_ANON
           MAP_ANONYMOUS
           MAP_POPULATE
+          MAP_STACK
 
     These are the various flags that can be passed to :meth:`mmap.mmap`. Note that some options might not be present on some systems.
 
     .. versionchanged:: 3.10
        Added MAP_POPULATE constant.
+
+    .. versionadded:: 3.11
+       Added MAP_STACK constant.
diff --git a/Misc/NEWS.d/next/Library/2021-12-25-11-11-21.bpo-46176.EOY9wd.rst b/Misc/NEWS.d/next/Library/2021-12-25-11-11-21.bpo-46176.EOY9wd.rst
new file mode 100644 (file)
index 0000000..4a50c26
--- /dev/null
@@ -0,0 +1 @@
+Adding the ``MAP_STACK`` constant for the mmap module.
\ No newline at end of file
index 399cb0a99ad655c4ad5c5501bf3deb3a6928c418..742bcb3d145faa992fab2a3e76e72e96232e1bf8 100644 (file)
@@ -1637,6 +1637,11 @@ mmap_exec(PyObject *module)
 #endif
 #ifdef MAP_POPULATE
     ADD_INT_MACRO(module, MAP_POPULATE);
+#endif
+#ifdef MAP_STACK
+    // Mostly a no-op on Linux and NetBSD, but useful on OpenBSD
+    // for stack usage (even on x86 arch)
+    ADD_INT_MACRO(module, MAP_STACK);
 #endif
     if (PyModule_AddIntConstant(module, "PAGESIZE", (long)my_getpagesize()) < 0 ) {
         return -1;