Skip to content

Commit 66c47b6

Browse files
authored
bpo-46176: mmap module adding MAP_STACK constant. (GH-30252)
1 parent 77195cd commit 66c47b6

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

Doc/library/mmap.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,8 +367,12 @@ MAP_* Constants
367367
MAP_ANON
368368
MAP_ANONYMOUS
369369
MAP_POPULATE
370+
MAP_STACK
370371

371372
These are the various flags that can be passed to :meth:`mmap.mmap`. Note that some options might not be present on some systems.
372373

373374
.. versionchanged:: 3.10
374375
Added MAP_POPULATE constant.
376+
377+
.. versionadded:: 3.11
378+
Added MAP_STACK constant.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Adding the ``MAP_STACK`` constant for the mmap module.

Modules/mmapmodule.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1637,6 +1637,11 @@ mmap_exec(PyObject *module)
16371637
#endif
16381638
#ifdef MAP_POPULATE
16391639
ADD_INT_MACRO(module, MAP_POPULATE);
1640+
#endif
1641+
#ifdef MAP_STACK
1642+
// Mostly a no-op on Linux and NetBSD, but useful on OpenBSD
1643+
// for stack usage (even on x86 arch)
1644+
ADD_INT_MACRO(module, MAP_STACK);
16401645
#endif
16411646
if (PyModule_AddIntConstant(module, "PAGESIZE", (long)my_getpagesize()) < 0 ) {
16421647
return -1;

0 commit comments

Comments
 (0)