[Python-checkins] bpo-46176: mmap module adding MAP_STACK constant. (GH-30252)
corona10
webhook-mailer at python.org
Wed Dec 29 08:52:42 EST 2021
https://github.com/python/cpython/commit/66c47b63a0df3143fe48d6efc1183eecda2a363d
commit: 66c47b63a0df3143fe48d6efc1183eecda2a363d
branch: main
author: David CARLIER <devnexen at gmail.com>
committer: corona10 <donghee.na92 at gmail.com>
date: 2021-12-29T22:52:29+09:00
summary:
bpo-46176: mmap module adding MAP_STACK constant. (GH-30252)
files:
A Misc/NEWS.d/next/Library/2021-12-25-11-11-21.bpo-46176.EOY9wd.rst
M Doc/library/mmap.rst
M Modules/mmapmodule.c
diff --git a/Doc/library/mmap.rst b/Doc/library/mmap.rst
index c1ebd80abd977..d19580cd7ee5c 100644
--- a/Doc/library/mmap.rst
+++ b/Doc/library/mmap.rst
@@ -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
index 0000000000000..4a50c2617200e
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2021-12-25-11-11-21.bpo-46176.EOY9wd.rst
@@ -0,0 +1 @@
+Adding the ``MAP_STACK`` constant for the mmap module.
\ No newline at end of file
diff --git a/Modules/mmapmodule.c b/Modules/mmapmodule.c
index 399cb0a99ad65..742bcb3d145fa 100644
--- a/Modules/mmapmodule.c
+++ b/Modules/mmapmodule.c
@@ -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;
More information about the Python-checkins
mailing list