Skip to content
Open
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions Doc/c-api/frame.rst
Original file line number Diff line number Diff line change
Expand Up @@ -250,3 +250,49 @@ Unless using :pep:`523`, you will not need this.
.. versionadded:: 3.12


.. c:enum:: PyUnstable_ExecutableKinds

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`.
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.

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.

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.

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

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.

Could @encukou or @StanFromIreland please review my suggestion above and correct it if its wrong or gimme the green light to commit this ⬆️

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.

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.


.. versionadded:: 3.13
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.

The .. versionadded:: ... should be the last thing in a function's/macro's/type's/etc. doc, please move it after the example.



.. c:macro:: PyUnstable_EXECUTABLE_KIND_SKIP

Index for the "skip" kind in ``PyUnstable_ExecutableKinds``.
Indicates that the frame's code object should be skipped.

.. versionadded:: 3.13


.. c:macro:: PyUnstable_EXECUTABLE_KIND_PY_FUNCTION

Index for the "Python function" kind in ``PyUnstable_ExecutableKinds``.
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.

These should be links via :c:data:`PyUnstable_ExecutableKinds`


.. versionadded:: 3.13


.. c:macro:: PyUnstable_EXECUTABLE_KIND_BUILTIN_FUNCTION

Index for the "built-in function" kind in ``PyUnstable_ExecutableKinds``.

.. versionadded:: 3.13


.. c:macro:: PyUnstable_EXECUTABLE_KIND_METHOD_DESCRIPTOR

Index for the "method descriptor" kind in ``PyUnstable_ExecutableKinds``.

.. versionadded:: 3.13


.. c:macro:: PyUnstable_EXECUTABLE_KINDS

The number of entries in ``PyUnstable_ExecutableKinds``.

.. versionadded:: 3.13



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.

Too many blank lines.

Loading