FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-141004: Document unstable perf map functions in `ceval.h` by Yashp002 · Pull Request #143492 · python/cpython · GitHub

/ cpython Public

gh-141004: Document unstable perf map functions in ceval.h - #143492

Merged
ZeroIntensity merged 8 commits into
python:mainfrom
Yashp002:doc-ceval-perf
Jun 3, 2026
Merged

gh-141004: Document unstable perf map functions in ceval.h#143492
ZeroIntensity merged 8 commits into
python:mainfrom
Yashp002:doc-ceval-perf

Conversation

Yashp002 commented Jan 6, 2026
edited by github-actions Bot
Loading

Copy link
Copy Markdown
Contributor

gh-141004: Document unstable perf map functions in ceval.h

This PR documents the PyUnstable_CopyPerfMapFile, PyUnstable_PerfTrampoline_CompileCode, and PyUnstable_PerfTrampoline_SetPersistAfterFork functions in Doc/c-api/perfmaps.rst.


📚 Documentation preview 📚: https://cpython-previews--143492.org.readthedocs.build/

bedevere-app Bot added docs Documentation in the Doc dir skip news labels Jan 6, 2026
github-project-automation Bot moved this to Todo in Docs PRs Jan 6, 2026
Comment thread Doc/c-api/frame.rst Outdated
.. versionadded:: 3.12


.. c:macro:: PyUnstable_EXECUTABLE_KIND_SKIP

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

You used the branch from the other PR, please remove these changes here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I'm so sorry yes, fixing rn.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I hope it's not an issue if i force push a new branch over this one to fix my error?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

In general, avoid them, in this case I think it is fine to remove the changes.

Comment thread Doc/c-api/perfmaps.rst

.. c:function:: int PyUnstable_CopyPerfMapFile(const char *parent_filename)

Open the ``/tmp/perf-$pid.map`` file and append the content of *parent_filename*

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

This should note what happens on Windows where this obviously won't work.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

That's the case for all of these functions; the info should be in the beginning of the section.

This doesn't open the perf map file directly; it should use the same wording as PyUnstable_WritePerfMapEntry: “Will call :c:func:PyUnstable_PerfMapState_Init…”

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

@encukou Would this wording be suitable then as a replacement for line 56 as:

"Calls :c:func:PyUnstable_PerfMapState_Init if the perf map is not yet
initialized, then append the content of parent_filename to the perf map."

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

@encukou or @StanFromIreland Could you verify this one too?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I'd say only “Append contents of the file named parent_filename to the perf map.” in the opening paragraph, and add the note about _Init later (like in WritePerfMapEntry docs).

Comment thread Doc/c-api/perfmaps.rst Outdated
Open the ``/tmp/perf-$pid.map`` file and append the content of *parent_filename*
to it.

:param parent_filename: The name of the file to copy.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Please don't use these (:param *: & :return:), like above use sentences.

Comment thread Doc/c-api/perfmaps.rst

.. c:function:: int PyUnstable_CopyPerfMapFile(const char *parent_filename)

Open the ``/tmp/perf-$pid.map`` file and append the content of *parent_filename*

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I'd say only “Append contents of the file named parent_filename to the perf map.” in the opening paragraph, and add the note about _Init later (like in WritePerfMapEntry docs).

Comment thread Doc/c-api/perfmaps.rst
Comment thread Doc/c-api/perfmaps.rst

ZeroIntensity left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Please update Tools/check-c-api-docs/ignored_c_api.txt as well.

Yashp002 commented Jan 8, 2026

Copy link
Copy Markdown
Contributor Author

@encukou , @ZeroIntensity

Docs unrelated to test failure

Tests / Windows (free-threading) / Build and test (arm64) (pull_request),Failing after 24m:

testexternalinspection.testcacheperthreadisolation fails in free-threading
ARM64 Windows CI (pre-existing).

Copy link
Copy Markdown
Contributor Author

@encukou @StanFromIreland
Could you guide me if there are further changes needed with this PR?

encukou left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I asked some more questions. Could you go through the unresolved comments here?

Comment thread Doc/c-api/perfmaps.rst Outdated
Comment on lines +53 to +54
These unstable functions let you access and set perf map information
about the current frame from C code.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

This doesn't make sense to me. What is the connection to the current frame?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

My bad, that text was completely out of place (and wrong). I'm deleting those lines entirely.

Comment thread Doc/c-api/perfmaps.rst Outdated
Comment on lines +56 to +57
Note: Appends the content of the parent frame to the current one in perf maps.
Just like in frameobject.h.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

What function(s) is this note for? What is the connection to frameobject.h?

Comment thread Doc/c-api/perfmaps.rst Outdated
Open the ``/tmp/perf-$pid.map`` file and append the content of *parent_filename*
to it.

This function is only available on platforms that support perf maps (currently

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

This is not accurate, the function is "available" on all platforms. But it should only be used on Linux. On Windows, it does nothing (it's not implemented).

github-actions Bot commented May 4, 2026

Copy link
Copy Markdown

This PR is stale because it has been open for 30 days with no activity.

github-actions Bot added the stale Stale PR or inactive for long period of time. label May 4, 2026

Copy link
Copy Markdown

Documentation build overview

📚 cpython-previews | 🛠️ Build #32971943 | 📁 Comparing ba3e3cf against main (5553e00)

  🔍 Preview build  

2 files changed
± c-api/perfmaps.html
± whatsnew/changelog.html

ZeroIntensity left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I don't see any more blocking issues here -- let's get these documented!

If anyone disagrees with anything here, or otherwise want to make some change to the test, feel free to send a follow-up and tag me on it.

ZeroIntensity enabled auto-merge (squash) June 3, 2026 12:33
ZeroIntensity added needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes needs backport to 3.15 pre-release feature fixes, bugs and security fixes and removed stale Stale PR or inactive for long period of time. labels Jun 3, 2026
ZeroIntensity merged commit 6453065 into python:main Jun 3, 2026
51 checks passed
github-project-automation Bot moved this from Todo to Done in Docs PRs Jun 3, 2026

Copy link
Copy Markdown

Thanks @Yashp002 for the PR, and @ZeroIntensity for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14, 3.15.
🐍🍒⛏🤖 I'm not a witch! I'm not a witch!

Copy link
Copy Markdown

Sorry, @Yashp002 and @ZeroIntensity, I could not cleanly backport this to 3.14 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker 6453065db9ff31e3f737240030f8311d2b087851 3.14

bedevere-app Bot commented Jun 3, 2026

Copy link
Copy Markdown

GH-150849 is a backport of this pull request to the 3.15 branch.

bedevere-app Bot removed the needs backport to 3.15 pre-release feature fixes, bugs and security fixes label Jun 3, 2026

Copy link
Copy Markdown

Sorry, @Yashp002 and @ZeroIntensity, I could not cleanly backport this to 3.13 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker 6453065db9ff31e3f737240030f8311d2b087851 3.13

ZeroIntensity pushed a commit that referenced this pull request Jun 3, 2026
…H-143492) (GH-150849)

gh-141004: Document unstable perf map functions in `ceval.h` (GH-143492)
(cherry picked from commit 6453065)

Co-authored-by: Yashraj <yashrajpala8@gmail.com>

Copy link
Copy Markdown
Member

Please don't forget about backports.

bedevere-app Bot commented Jul 18, 2026

Copy link
Copy Markdown

GH-153994 is a backport of this pull request to the 3.14 branch.

bedevere-app Bot removed the needs backport to 3.14 bugs and security fixes label Jul 18, 2026

bedevere-app Bot commented Jul 18, 2026

Copy link
Copy Markdown

GH-153996 is a backport of this pull request to the 3.13 branch.

bedevere-app Bot removed the needs backport to 3.13 bugs and security fixes label Jul 18, 2026
ZeroIntensity added a commit that referenced this pull request Jul 18, 2026
…H-143492) (GH-153996)

(cherry picked from commit 6453065)

Co-authored-by: Yashraj <yashrajpala8@gmail.com>
ZeroIntensity added a commit that referenced this pull request Jul 18, 2026
…H-143492) (GH-153994)

(cherry picked from commit 6453065)

Co-authored-by: Yashraj <yashrajpala8@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation in the Doc dir skip news

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

6 participants


Back | FazBrowse Home | New Git URL