]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-119786: Remove mention of `_PyThreadState_BumpFramePointer` from `InternalDocs...
authorMikhail Efimov <efimov.mikhail@gmail.com>
Tue, 16 Dec 2025 11:49:14 +0000 (14:49 +0300)
committerGitHub <noreply@github.com>
Tue, 16 Dec 2025 11:49:14 +0000 (13:49 +0200)
Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
InternalDocs/interpreter.md

index 38e9f6fced60880a621dd6d5383c770877546787..75acdf596a7f302e757249f7efa38a1919724ac8 100644 (file)
@@ -226,10 +226,11 @@ Up through 3.10, the call stack was implemented as a singly-linked list of
 heap allocation for the stack frame.
 
 Since 3.11, frames are no longer fully-fledged objects. Instead, a leaner internal
-`_PyInterpreterFrame` structure is used, which is allocated using a custom allocator
-function (`_PyThreadState_BumpFramePointer()`), which allocates and initializes a
-frame structure. Usually a frame allocation is just a pointer bump, which improves
-memory locality.
+`_PyInterpreterFrame` structure is used. Most frames are allocated contiguously in a
+per-thread stack (see `_PyThreadState_PushFrame` in [Python/pystate.c](../Python/pystate.c)),
+which improves memory locality and reduces overhead.
+If the current `datastack_chunk` has enough space (`_PyThreadState_HasStackSpace`)
+then the lightweight `_PyFrame_PushUnchecked` can be used instead of `_PyThreadState_PushFrame`.
 
 Sometimes an actual `PyFrameObject` is needed, such as when Python code calls
 `sys._getframe()` or an extension module calls