gh-141004: Document unstable executable kind macros in pyframe.h#143490
gh-141004: Document unstable executable kind macros in pyframe.h#143490Yashp002 wants to merge 11 commits intopython:mainfrom
pyframe.h#143490Conversation
Doc/c-api/frame.rst
Outdated
| Index for the "skip" kind in ``PyUnstable_ExecutableKinds``. | ||
| Indicates that the frame's code object should be skipped. | ||
|
|
||
| .. versionadded:: 3.12 |
|
These are rather useless without docs for |
|
@encukou ok, makes sense. I'll add the documentation for PyUnstable_ExecutableKinds and link these macros to it. Thanks :) |
Doc/c-api/frame.rst
Outdated
| An enumeration of the different kinds of executables (code objects) in a frame. | ||
| This can be one of the constants :c:macro:`PyUnstable_EXECUTABLE_KIND_SKIP` | ||
| or :c:macro:`PyUnstable_EXECUTABLE_KIND_PY_FUNCTION`. |
There was a problem hiding this comment.
It's an array, not an enum.
Could you document what it's useful for or how to use it? That part isn't very clear to me.
There was a problem hiding this comment.
Please go through what i've mentioned below and let me know if its perfectly appropriate, and as soon I recieve the heads up i'll update and commit:
.. c:var:: PyUnstable_ExecutableKinds
An array of executable kinds (executor types) for frames, used for internal
debugging and tracing. The entries are indexed by the constants
:c:macro:PyUnstable_EXECUTABLE_KIND_SKIP or
:c:macro:PyUnstable_EXECUTABLE_KIND_PY_FUNCTION.
This can be used to identify the type of the code object associated with a frame.
.. versionadded:: 3.13
There was a problem hiding this comment.
Could @encukou or @StanFromIreland please review my suggestion above and correct it if its wrong or gimme the green light to commit this ⬆️
There was a problem hiding this comment.
I'd prefer some words on why/how you'd use this.
You can say “The entries are indexed by the following constants:”, and indent the docs for the constants. Since the entries are all similar, you could even use a compact table, like in code object flags.
ZeroIntensity
left a comment
There was a problem hiding this comment.
You need to update ignored_c_api.txt here too.
Doc/c-api/frame.rst
Outdated
|
|
||
|
|
||
|
|
|
|
||
| .. c:macro:: PyUnstable_EXECUTABLE_KIND_PY_FUNCTION | ||
|
|
||
| Index for the "Python function" kind in ``PyUnstable_ExecutableKinds``. |
There was a problem hiding this comment.
These should be links via :c:data:`PyUnstable_ExecutableKinds`
|
test_asyncio.test_sendfile port conflict - unrelated to docs. |
|
We don't need those tests to run at all really, we can (I think) exclude the ignore file from triggering the Edit: See #143583. |
Can the same be said for #143492 |
|
@StanFromIreland @encukou Here too, do I need to make any more changes? |
|
This part is not clear to me:
I assume “frame” refers to 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 |
|
@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? Also, Yes the frame refers to PyFrameObject and I'll be adding a sentence below saying "The frame should be skipped by tools. Should i go ahead with above mentioned changes? |
Yes. But switch to the Example code would be very helpful, yes. Please test that it works, though. |
Doc/c-api/frame.rst
Outdated
| debugging and tracing. | ||
|
|
||
| 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). |
There was a problem hiding this comment.
Please do not use latin abbreviations, see our style guide for more information.
There was a problem hiding this comment.
Yeah you mentioned this before, I'm sorry it slipped my mind, fixing now.
Doc/c-api/frame.rst
Outdated
| * - .. c:macro:: PyUnstable_EXECUTABLE_KIND_PY_FUNCTION | ||
| - The frame corresponds to a standard Python function. | ||
|
|
||
| .. versionadded:: 3.13 |
There was a problem hiding this comment.
The .. versionadded:: ... should be the last thing in a function's/macro's/type's/etc. doc, please move it after the example.
| .. code-block:: c | ||
|
|
||
| // Check if a frame should be skipped | ||
| if (kind == PyUnstable_EXECUTABLE_KIND_SKIP) { |
There was a problem hiding this comment.
What is kind? How do you get it?
There was a problem hiding this comment.
@encukou kind here refers to the executable kind field stored in the frame's executor (e.g. _PyFrame_GetExecutableKind(frame))
Do you think it's better to explicitly show _PyFrame_GetExecutableKind (if exposed), or should I just remove the example block to avoid confusion?
There was a problem hiding this comment.
Yes, explicitly show your _PyFrame_GetExecutableKind. We'll also need to make it public (or at least unstable) if we want users to use it.
|
@encukou could u check if these changes are satisfactory |

gh-141004: Document unstable executable kind macros in
pyframe.hThis PR documents the
PyUnstable_EXECUTABLE_KIND_*macros and thePyUnstable_ExecutableKindsarray inDoc/c-api/frame.rst. These were listed as undocumented in the parent issue.📚 Documentation preview 📚: https://cpython-previews--143490.org.readthedocs.build/