◐ Shell
reader mode source ↗
Skip to content

gh-141004: Document unstable executable kind macros in pyframe.h#143490

Open
Yashp002 wants to merge 12 commits into
python:mainfrom
Yashp002:doc-pyframe-unstable
Open

gh-141004: Document unstable executable kind macros in pyframe.h#143490
Yashp002 wants to merge 12 commits into
python:mainfrom
Yashp002:doc-pyframe-unstable

Conversation

@Yashp002

@Yashp002 Yashp002 commented Jan 6, 2026

Copy link
Copy Markdown
Contributor

gh-141004: Document unstable executable kind macros in pyframe.h

This PR documents the PyUnstable_EXECUTABLE_KIND_* macros and the PyUnstable_ExecutableKinds array in Doc/c-api/frame.rst. These were listed as undocumented in the parent issue.


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

@bedevere-app bedevere-app Bot added docs Documentation in the Doc dir skip news labels Jan 6, 2026
@github-project-automation github-project-automation Bot moved this to Todo in Docs PRs Jan 6, 2026
@encukou

encukou commented Jan 7, 2026

Copy link
Copy Markdown
Member

These are rather useless without docs for PyUnstable_ExecutableKinds.
Once you document that, you can associate the macros with it, like for example Py_MOD_GIL_USED with Py_mod_gil.

@Yashp002

Yashp002 commented Jan 7, 2026

Copy link
Copy Markdown
Contributor Author

@encukou ok, makes sense. I'll add the documentation for PyUnstable_ExecutableKinds and link these macros to it. Thanks :)

@ZeroIntensity 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.

Hide comment

You need to update ignored_c_api.txt here too.

@Yashp002

Yashp002 commented Jan 8, 2026

Copy link
Copy Markdown
Contributor Author

test_asyncio.test_sendfile port conflict - unrelated to docs.

@StanFromIreland

StanFromIreland commented Jan 8, 2026

Copy link
Copy Markdown
Member

We don't need those tests to run at all really, we can (I think) exclude the ignore file from triggering the run-tests condition.

Edit: See #143583.

@Yashp002

Yashp002 commented Jan 8, 2026

Copy link
Copy Markdown
Contributor Author

We don't need those tests to run at all really, we can (I think) exclude the ignore file from triggering the run-tests condition.

Edit: See #143583.

Can the same be said for #143492
and #143494 then? @StanFromIreland

@Yashp002

Copy link
Copy Markdown
Contributor Author

@StanFromIreland @encukou Here too, do I need to make any more changes?

@encukou

encukou commented Jan 19, 2026

Copy link
Copy Markdown
Member

This part is not clear to me:

Tools like debuggers and profilers can use this to identify the type of execution
context associated with a frame (e.g. to filter out internal frames).

I assume “frame” refers to PyFrameObject?
How do you use this array to filter out internal frames?


Once the docs say what the function is for and how to use it, there are some presentation issues to fix up:

There are now two descriptions for PyUnstable_EXECUTABLE_KIND_SKIP: on in list-table and one below. Choose one. If you need a full/sentence, use individual entries; if you only need a few words then the table makes sense.
Either way, indent the macro docs so they're under PyUnstable_ExecutableKinds, and use .. c:namespace:: NULL (see elsewhere in the docs for examples).

@Yashp002

Copy link
Copy Markdown
Contributor Author

@encukou Since PyUnstable_EXECUTABLE_KIND_SKIP has only a couple words, should I just keep the list-table description and remove the one below completely?
image
as in the description of it below.

Also, Yes the frame refers to PyFrameObject and I'll be adding a sentence below saying "The frame should be skipped by tools.
- The frame corresponds to a standard Py function"

    Also, to check for internal frames:
    perf_map = PyUnstable_GetPerfMapFile()
    for i, kind in enumerate(perf_map):
       if kind == PyUnstable_EXECUTABLE_KIND_SKIP:
          skip_frame(i) 
          
          It's from the Cpython source code

Should i go ahead with above mentioned changes?
Also, my indents with c:macro: are fine right? or have i missed something

@encukou

encukou commented Jan 22, 2026

Copy link
Copy Markdown
Member

Since PyUnstable_EXECUTABLE_KIND_SKIP has only a couple words, should I just keep the list-table description and remove the one below completely?

Yes. But switch to the .. c:macro: syntax rather than :c:macro:, so this is a definition.

Example code would be very helpful, yes. Please test that it works, though.

@Yashp002

Yashp002 commented Feb 5, 2026

Copy link
Copy Markdown
Contributor Author

@encukou could u check if these changes are satisfactory

@encukou

encukou commented Feb 5, 2026

Copy link
Copy Markdown
Member

How did you check that the example code works?

@Yashp002

Yashp002 commented Feb 6, 2026

Copy link
Copy Markdown
Contributor Author

@encukou
i've made changes to

modified: Doc/c-api/frame.rst
modified: Include/cpython/frameobject.h
modified: Modules/_testcapi/frame.c
modified: Python/frame.c

the tests seem to pass and the build works

@github-actions

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 github-actions Bot added the stale Stale PR or inactive for long period of time. label May 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting review docs skip news stale Stale PR or inactive for long period of time.

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

5 participants