cpython/Include/cpython
Pablo Galindo Salgado 96e4cd698a
gh-144319: Fix huge page safety in pymalloc arenas (#144331)
The pymalloc huge page support had two problems. First, on
architectures where the default huge page size exceeds the arena
size (e.g. 32 MiB on PPC, 512 MiB on ARM64 with 64 KB base
pages), mmap with MAP_HUGETLB silently allocates a full huge page
even when the requested size is smaller. The subsequent munmap
with the original arena size then fails with EINVAL, permanently
leaking the entire huge page. Second, huge pages were always
attempted when compiled in, with no way to disable them at
runtime. On Linux, if the huge page pool is exhausted, page
faults including copy-on-write faults after fork deliver SIGBUS
and kill the process.

The arena allocator now queries the system huge page size from
/proc/meminfo and skips MAP_HUGETLB when the arena size is not a
multiple of it. Huge pages also now require explicit opt-in at
runtime via the PYTHON_PYMALLOC_HUGEPAGES environment variable,
which is read through PyConfig and respects -E and -I flags.
The config field pymalloc_hugepages is propagated to the runtime
allocators struct so the low-level arena allocator can check it
without calling getenv directly.
2026-01-30 18:18:56 +00:00
..
abstract.h gh-142217: Deprecate the private _Py_Identifier C API (#142221) 2025-12-12 14:10:25 +01:00
audit.h gh-135755: Use private names (_Py*) for header file guards new in 3.14 (GH-135921) 2025-06-26 13:05:01 +02:00
bytearrayobject.h gh-139871: Add bytearray.take_bytes([n]) to efficiently extract bytes (GH-140128) 2025-11-13 13:19:44 +00:00
bytesobject.h gh-129813, PEP 782: Add PyBytesWriter_Format() (#138824) 2025-09-12 14:21:57 +02:00
cellobject.h gh-127271: Replace use of PyCell_GET/SET (gh-127272) 2024-12-03 10:33:06 -08:00
ceval.h gh-125604: Move _Py_AuditHookEntry, etc. Out of pycore_runtime.h (gh-125605) 2024-10-18 09:26:08 -06:00
classobject.h gh-89653: PEP 670: Convert macros to functions (#99843) 2022-11-28 16:40:08 +01:00
code.h gh-70030: Remove _PyCode_ConstantKey() function (#139735) 2025-10-08 22:33:45 +02:00
compile.h gh-117411: move PyFutureFeatures to pycore_symtable.h and make it private (#117412) 2024-04-02 10:34:49 +00:00
complexobject.h gh-128813: soft-deprecate _Py_c_*() functions (GH-137261) 2025-08-01 09:40:12 +02:00
context.h gh-124872: Replace enter/exit events with "switched" (#125532) 2024-10-16 13:53:21 +02:00
critical_section.h gh-133296: Publicly expose critical section API that accepts PyMutex (gh-135899) 2025-07-21 17:25:43 -04:00
descrobject.h gh-106320: Move _PyMethodWrapper_Type to internal C API (#107064) 2023-07-22 20:57:59 +00:00
dictobject.h gh-141726: Add PyDict_SetDefaultRef() to the Stable ABI (#141727) 2025-11-19 11:38:10 +00:00
fileobject.h gh-106320: Remove private _Py_UniversalNewlineFgetsWithSize() (#108602) 2023-08-29 02:36:50 +00:00
fileutils.h gh-128863: Deprecate private C API functions (#128864) 2025-01-22 11:04:19 +00:00
floatobject.h gh-89653: PEP 670: Convert macros to functions (#99843) 2022-11-28 16:40:08 +01:00
frameobject.h gh-74929: Implement PEP 667 (GH-115153) 2024-05-04 12:12:10 +01:00
funcobject.h gh-139924: Add PyFunction_PYFUNC_EVENT_MODIFY_QUALNAME event for function watchers (#139925) 2025-10-10 15:25:38 -07:00
genobject.h gh-120834: fix type of *_iframe field in _PyGenObject_HEAD declaration (#120835) 2024-06-24 10:23:38 +01:00
import.h gh-116146: Add C-API to create module from spec and initfunc (GH-139196) 2025-11-14 10:43:25 +01:00
initconfig.h gh-144319: Fix huge page safety in pymalloc arenas (#144331) 2026-01-30 18:18:56 +00:00
listobject.h gh-112087: Make list_repr and list_length to be thread-safe (gh-114582) 2024-01-27 01:20:21 +09:00
longintrepr.h gh-143869: Add PEP 757 functions to the limited API (#143906) 2026-01-21 14:47:14 +01:00
longobject.h gh-132639: Adds PyLong_AsNativeBytes, PyLong_FromNativeBytes and PyLong_FromUnsignedNativeBytes to the limited API (GH-132640) 2025-04-21 15:59:03 +01:00
marshal.h gh-79315: Add Include/cpython/marshal.h header (#139725) 2025-10-07 23:49:08 +02:00
memoryobject.h gh-106320: Remove private _PyManagedBuffer_Type (#108431) 2023-08-24 19:07:54 +02:00
methodobject.h gh-87347: Add parenthesis around PyXXX_Check() arguments (#92815) 2022-06-16 13:49:43 +02:00
modsupport.h gh-137210: Add a struct, slot & function for checking an extension's ABI (GH-137212) 2025-09-05 16:23:18 +02:00
monitoring.h gh-79315: Remove Include/pylock.h and Include/monitoring.h (#139731) 2025-10-08 00:49:24 +02:00
object.h gh-141070: Rename PyUnstable_Object_Dump to PyObject_Dump (GH-142848) 2026-01-16 09:19:43 -05:00
objimpl.h gh-102013: Move PyUnstable_GC_VisitObjects() to Include/cpython/objimpl.h (#115560) 2024-02-16 15:49:13 +01:00
odictobject.h gh-87347: Add parenthesis around macro arguments (#93915) 2022-06-20 16:04:52 +02:00
picklebufobject.h gh-87347: Add parenthesis around PyXXX_Check() arguments (#92815) 2022-06-16 13:49:43 +02:00
pthread_stubs.h GH-110829: Ensure Thread.join() joins the OS thread (#110848) 2023-11-04 13:59:24 +00:00
pyatomic.h gh-120321: Make gi_frame_state transitions atomic in FT build (gh-142599) 2025-12-19 19:10:37 +00:00
pyatomic_gcc.h gh-120321: Make gi_frame_state transitions atomic in FT build (gh-142599) 2025-12-19 19:10:37 +00:00
pyatomic_msc.h gh-120321: Make gi_frame_state transitions atomic in FT build (gh-142599) 2025-12-19 19:10:37 +00:00
pyatomic_std.h gh-120321: Make gi_frame_state transitions atomic in FT build (gh-142599) 2025-12-19 19:10:37 +00:00
pyctype.h bpo-43816: Add extern "C" to Include/cpython/pyctype.h (GH-25365) 2021-04-13 13:27:21 +02:00
pydebug.h gh-77782: Deprecate global configuration variable (#93943) 2022-06-17 16:12:00 +02:00
pyerrors.h gh-141732: Fix ExceptionGroup repr changing when original exception sequence is mutated (#141736) 2025-12-07 21:04:04 +00:00
pyfpe.h bpo-35134: Move non-limited C API files to Include/cpython/ (GH-24561) 2021-02-19 15:55:46 +01:00
pyframe.h Fix typos in comments (#120188) 2024-06-07 10:19:41 +02:00
pyhash.h gh-111389: replace deprecated occurrences of _PyHASH_* macros (#141236) 2025-11-09 15:14:08 +01:00
pylifecycle.h gh-129033: Remove _Py_InitializeMain() function (#129034) 2025-01-20 10:03:22 +00:00
pylock.h gh-79315: Remove Include/pylock.h and Include/monitoring.h (#139731) 2025-10-08 00:49:24 +02:00
pymem.h gh-90815: Add mimalloc memory allocator (#109914) 2023-10-30 15:43:11 +00:00
pystate.h gh-138122: Don't sample partial frame chains (#141912) 2025-12-07 15:53:48 +00:00
pystats.h GH-135379: Top of stack caching for the JIT. (GH-135465) 2025-12-11 10:32:52 +00:00
pythonrun.h gh-106320: Remove private pythonrun API (#108599) 2023-08-29 04:18:52 +02:00
pythread.h gh-129296: Fix pyatomic.h include paths (#129320) 2025-01-29 15:06:19 +00:00
pytime.h gh-110850: Add PyTime_TimeRaw() function (#118394) 2024-05-01 18:05:01 +00:00
setobject.h gh-112069: Make PySet_GET_SIZE to be atomic safe. (gh-118053) 2024-04-19 06:40:28 +09:00
sliceobject.h gh-79315: Add Include/cpython/sliceobject.h header (#139729) 2025-10-08 00:48:18 +02:00
structseq.h gh-79315: Add Include/cpython/structseq.h header (#139730) 2025-10-08 01:19:50 +02:00
traceback.h gh-106320: Remove private _PyTraceback functions (#108453) 2023-08-24 23:35:47 +00:00
tracemalloc.h Add extern "C" around PyTraceMalloc_ functions. (#127772) 2024-12-11 10:27:07 +01:00
tupleobject.h gh-111489: Add PyTuple_FromArray() function (#139691) 2025-10-10 08:54:12 +02:00
unicodeobject.h gh-142217: Deprecate the private _Py_Identifier C API (#142221) 2025-12-12 14:10:25 +01:00
warnings.h gh-139640: Fix swallowing syntax warnings in different modules (GH-139755) 2025-10-14 17:48:09 +03:00
weakrefobject.h gh-133644: remove PyWeakref_GetObject and PyWeakref_GET_OBJECT (GH-133657) 2025-09-24 11:25:56 +02:00