diff options
author | David CARLIER <devnexen@gmail.com> | 2021-12-29 13:52:29 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-29 22:52:29 +0900 |
commit | 66c47b63a0df3143fe48d6efc1183eecda2a363d (patch) | |
tree | e2afecfc8dd8583c2bbb45e9462d82d6f735d3ca | |
parent | 77195cd44b2506cda88a3cfc98918526068b1d46 (diff) | |
download | cpython-git-66c47b63a0df3143fe48d6efc1183eecda2a363d.tar.gz |
bpo-46176: mmap module adding MAP_STACK constant. (GH-30252)
-rw-r--r-- | Doc/library/mmap.rst | 4 | ||||
-rw-r--r-- | Misc/NEWS.d/next/Library/2021-12-25-11-11-21.bpo-46176.EOY9wd.rst | 1 | ||||
-rw-r--r-- | Modules/mmapmodule.c | 5 |
3 files changed, 10 insertions, 0 deletions
diff --git a/Doc/library/mmap.rst b/Doc/library/mmap.rst index c1ebd80abd..d19580cd7e 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 0000000000..4a50c26172 --- /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 399cb0a99a..742bcb3d14 100644 --- a/Modules/mmapmodule.c +++ b/Modules/mmapmodule.c @@ -1638,6 +1638,11 @@ mmap_exec(PyObject *module) #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; } |