https://github.com/python/cpython/commit/27c5953a550244fceea47f03b8749587a04d097b
commit: 27c5953a550244fceea47f03b8749587a04d097b
branch: 3.14
author: Peter Bierma <[email protected]>
committer: ZeroIntensity <[email protected]>
date: 2026-07-18T15:10:05Z
summary:

[3.14] gh-141004: Document unstable perf map functions in `ceval.h` (GH-143492) 
(GH-153994)

(cherry picked from commit 6453065db9ff31e3f737240030f8311d2b087851)

Co-authored-by: Yashraj <[email protected]>

files:
M Doc/c-api/perfmaps.rst

diff --git a/Doc/c-api/perfmaps.rst b/Doc/c-api/perfmaps.rst
index 77b5e3c0876bbb..68c2578906ff09 100644
--- a/Doc/c-api/perfmaps.rst
+++ b/Doc/c-api/perfmaps.rst
@@ -48,3 +48,43 @@ Note that holding an :term:`attached thread state` is not 
required for these API
    This is called by the runtime itself during interpreter shut-down. In
    general, there shouldn't be a reason to explicitly call this, except to
    handle specific scenarios such as forking.
+
+.. c:function:: int PyUnstable_CopyPerfMapFile(const char *parent_filename)
+
+   Open the ``/tmp/perf-$pid.map`` file and append the content of 
*parent_filename*
+   to it.
+
+   This function is available on all platforms but only generates output on 
platforms
+   that support perf maps (currently only Linux). On other platforms, it does 
nothing.
+
+   .. versionadded:: 3.13
+
+.. c:function:: int PyUnstable_PerfTrampoline_CompileCode(PyCodeObject *code)
+
+   Compile the given code object using the current perf trampoline.
+
+   The "current" trampoline is the one set by the runtime or the most recent
+   :c:func:`PyUnstable_PerfTrampoline_SetPersistAfterFork` call.
+
+   If no trampoline is set, falls back to normal compilation (no perf map 
entry).
+
+   :param code: The code object to compile.
+   :return: 0 on success, -1 on failure.
+
+   .. versionadded:: 3.13
+
+.. c:function:: int PyUnstable_PerfTrampoline_SetPersistAfterFork(int enable)
+
+   Set whether the perf trampoline should persist after a fork.
+
+   * If ``enable`` is true (non-zero): perf map file remains open/valid 
post-fork.
+     Child process inherits all existing perf map entries.
+   * If ``enable`` is false (zero): perf map closes post-fork.
+     Child process gets empty perf map.
+
+   Default: false (clears on fork).
+
+   :param enable: 1 to enable, 0 to disable.
+   :return: 0 on success, -1 on failure.
+
+   .. versionadded:: 3.13

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to