Skip to content

Commit

Permalink
bpo-46176: mmap module adding MAP_STACK constant. (GH-30252)
Browse files Browse the repository at this point in the history
  • Loading branch information
devnexen committed Dec 29, 2021
1 parent 77195cd commit 66c47b6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Doc/library/mmap.rst
Expand Up @@ -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.
@@ -0,0 +1 @@
Adding the ``MAP_STACK`` constant for the mmap module.
5 changes: 5 additions & 0 deletions Modules/mmapmodule.c
Expand Up @@ -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;
Expand Down

0 comments on commit 66c47b6

Please sign in to comment.