| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
| Index for the "skip" kind in ``PyUnstable_ExecutableKinds``. | ||
| Indicates that the frame's code object should be skipped. | ||
|
|
||
| .. versionadded:: 3.12 |
There was a problem hiding this comment.
9c03215 was not backported to 3.12?
Sorry, something went wrong.
|
These are rather useless without docs for PyUnstable_ExecutableKinds. |
Sorry, something went wrong.
|
@encukou ok, makes sense. I'll add the documentation for PyUnstable_ExecutableKinds and link these macros to it. Thanks :) |
Sorry, something went wrong.
| 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.
Sorry, something went wrong.
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
Sorry, something went wrong.
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 ⬆️
Sorry, something went wrong.
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.
Sorry, something went wrong.
There was a problem hiding this comment.
You need to update ignored_c_api.txt here too.
Sorry, something went wrong.
|
|
||
|
|
||
|
|
There was a problem hiding this comment.
Too many blank lines.
Sorry, something went wrong.
|
|
||
| .. 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`
Sorry, something went wrong.
|
test_asyncio.test_sendfile port conflict - unrelated to docs. |
Sorry, something went wrong.
|
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. |
Sorry, something went wrong.
Can the same be said for #143492 |
Sorry, something went wrong.
|
@StanFromIreland @encukou Here too, do I need to make any more changes? |
Sorry, something went wrong.
|
This part is not clear to me:
I assume “frame” refers to PyFrameObject? 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. |
Sorry, something went wrong.
|
@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. 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? |
Sorry, something went wrong.
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. |
Sorry, something went wrong.
| 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.
Sorry, something went wrong.
There was a problem hiding this comment.
Yeah you mentioned this before, I'm sorry it slipped my mind, fixing now.
Sorry, something went wrong.
| * - .. 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.
Sorry, something went wrong.
| .. 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?
Sorry, something went wrong.
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?
Sorry, something went wrong.
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.
Sorry, something went wrong.
There was a problem hiding this comment.
Yeah, there's no API for getting kind. The only way to get the right thing is to check the type, but at that point, you don't need PyUnstable_ExecutableKinds anyway (because the whole point of it is that you're not supposed to know the type in advance). This API is quite literally useless. I think we should remove it in 3.16, but for completeness, I want this documented in 3.13+.
Sorry, something went wrong.
|
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. |
Sorry, something went wrong.
|
Sorry, @Yashp002 and @ZeroIntensity, I could not cleanly backport this to 3.14 due to a conflict. cherry_picker dc62ba84ab2b83d70dee111d3feec1a6f1c3f69d 3.14 |
Sorry, something went wrong.
|
GH-153988 is a backport of this pull request to the 3.15 branch. |
Sorry, something went wrong.
|
Sorry, @Yashp002 and @ZeroIntensity, I could not cleanly backport this to 3.13 due to a conflict. cherry_picker dc62ba84ab2b83d70dee111d3feec1a6f1c3f69d 3.13 |
Sorry, something went wrong.
|
GH-153991 is a backport of this pull request to the 3.14 branch. |
Sorry, something went wrong.
|
GH-153993 is a backport of this pull request to the 3.13 branch. |
Sorry, something went wrong.
|
Just getting back to this. |
Sorry, something went wrong.
|
I would be much more comfortable with removing the API entirely. |
Sorry, something went wrong.
|
Yeah, for 3.16. But what about the older branches? |
Sorry, something went wrong.
|
Yeah, let's remove the snippet there, or add a note saying "you need Py_BUILD_CORE for this." Realistically, we're not going to change the type of f_executable on 3.13-3.15 (and if we were, this API wouldn't be a huge concern -- the debuggers we'd break would be a much bigger problem). |
Sorry, something went wrong.
Follow-up to GH-143490. `_PyInterpreterFrame.f_executable` and `PyStackRef_AsPyObjectBorrow` are undocumented and only available in the internal API. Docs should not suggest using them, even if `PyUnstable_ExecutableKinds` is unusable without them. Co-authored-by: Stan Ulbrych <stan@python.org>
…5122) (GH-155242) Follow-up to GH-143490. `_PyInterpreterFrame.f_executable` and `PyStackRef_AsPyObjectBorrow` are undocumented and only available in the internal API. Docs should not suggest using them, even if `PyUnstable_ExecutableKinds` is unusable without them. (cherry picked from commit c5d4946) Co-authored-by: Petr Viktorin <encukou@gmail.com> Co-authored-by: Stan Ulbrych <stan@python.org>
…5122) (GH-155240) Follow-up to GH-143490. `_PyInterpreterFrame.f_executable` and `PyStackRef_AsPyObjectBorrow` are undocumented and only available in the internal API. Docs should not suggest using them, even if `PyUnstable_ExecutableKinds` is unusable without them. (cherry picked from commit c5d4946) Co-authored-by: Petr Viktorin <encukou@gmail.com> Co-authored-by: Stan Ulbrych <stan@python.org>
…GH-155122) Follow-up to pythonGH-143490. `_PyInterpreterFrame.f_executable` and `PyStackRef_AsPyObjectBorrow` are undocumented and only available in the internal API. Docs should not suggest using them, even if `PyUnstable_ExecutableKinds` is unusable without them. Co-authored-by: Stan Ulbrych <stan@python.org>
| Back | FazBrowse Home | New Git URL |
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/