Skip to content

GH-109975: Copyedit 3.13 What's New: C API #124313

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Sep 23, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
10 changes: 5 additions & 5 deletions Doc/c-api/monitoring.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.. highlight:: c

.. _monitoring:
.. _c-api-monitoring:

Monitoring C API
================
Expand Down Expand Up @@ -141,18 +141,18 @@ would typically correspond to a python function.
to the base-2 logarithm of ``sys.monitoring.events.PY_START``.
``state_array`` is an array with a monitoring state entry for each event in
``event_types``, it is allocated by the user but populated by
``PyMonitoring_EnterScope`` with information about the activation state of
:c:func:`!PyMonitoring_EnterScope` with information about the activation state of
the event. The size of ``event_types`` (and hence also of ``state_array``)
is given in ``length``.

The ``version`` argument is a pointer to a value which should be allocated
by the user together with ``state_array`` and initialized to 0,
and then set only by ``PyMonitoring_EnterScope`` itelf. It allows this
and then set only by :c:func:`!PyMonitoring_EnterScope` itelf. It allows this
function to determine whether event states have changed since the previous call,
and to return quickly if they have not.

The scopes referred to here are lexical scopes: a function, class or method.
``PyMonitoring_EnterScope`` should be called whenever the lexical scope is
:c:func:`!PyMonitoring_EnterScope` should be called whenever the lexical scope is
entered. Scopes can be reentered, reusing the same *state_array* and *version*,
in situations like when emulating a recursive Python function. When a code-like's
execution is paused, such as when emulating a generator, the scope needs to
Expand Down Expand Up @@ -189,4 +189,4 @@ would typically correspond to a python function.

.. c:function:: int PyMonitoring_ExitScope(void)

Exit the last scope that was entered with ``PyMonitoring_EnterScope``.
Exit the last scope that was entered with :c:func:`!PyMonitoring_EnterScope`.
2 changes: 2 additions & 0 deletions Doc/c-api/time.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
.. highlight:: c

.. _c-api-time:

PyTime C API
============

Expand Down
2 changes: 1 addition & 1 deletion Doc/library/sys.monitoring.rst
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ Per code object events
Events can also be controlled on a per code object basis. The functions
defined below which accept a :class:`types.CodeType` should be prepared
to accept a look-alike object from functions which are not defined
in Python (see :ref:`monitoring`).
in Python (see :ref:`c-api-monitoring`).

.. function:: get_local_events(tool_id: int, code: CodeType, /) -> int

Expand Down
Loading
Loading