bpo-46176: mmap module adding MAP_STACK constant. (GH-30252)

This commit is contained in:
David CARLIER 2021-12-29 13:52:29 +00:00 committed by GitHub
parent 77195cd44b
commit 66c47b63a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 0 deletions

View 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.

View File

@ -0,0 +1 @@
Adding the ``MAP_STACK`` constant for the mmap module.

View 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;