Skip to content
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

gh-101100: Fix incorrect roles of PyTrace_* #106299

Closed
wants to merge 1 commit into from
Closed
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
32 changes: 16 additions & 16 deletions Doc/c-api/init.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1407,31 +1407,31 @@ Python-level trace functions in previous versions.
The type of the trace function registered using :c:func:`PyEval_SetProfile` and
:c:func:`PyEval_SetTrace`. The first parameter is the object passed to the
registration function as *obj*, *frame* is the frame object to which the event
pertains, *what* is one of the constants :const:`PyTrace_CALL`,
:const:`PyTrace_EXCEPTION`, :const:`PyTrace_LINE`, :const:`PyTrace_RETURN`,
:const:`PyTrace_C_CALL`, :const:`PyTrace_C_EXCEPTION`, :const:`PyTrace_C_RETURN`,
or :const:`PyTrace_OPCODE`, and *arg* depends on the value of *what*:
pertains, *what* is one of the constants :c:data:`PyTrace_CALL`,
:c:data:`PyTrace_EXCEPTION`, :c:data:`PyTrace_LINE`, :c:data:`PyTrace_RETURN`,
:c:data:`PyTrace_C_CALL`, :c:data:`PyTrace_C_EXCEPTION`, :c:data:`PyTrace_C_RETURN`,
or :c:data:`PyTrace_OPCODE`, and *arg* depends on the value of *what*:

+------------------------------+----------------------------------------+
| Value of *what* | Meaning of *arg* |
+==============================+========================================+
| :const:`PyTrace_CALL` | Always :c:data:`Py_None`. |
| :c:data:`PyTrace_CALL` | Always :c:data:`Py_None`. |
+------------------------------+----------------------------------------+
| :const:`PyTrace_EXCEPTION` | Exception information as returned by |
| :c:data:`PyTrace_EXCEPTION` | Exception information as returned by |
| | :func:`sys.exc_info`. |
+------------------------------+----------------------------------------+
| :const:`PyTrace_LINE` | Always :c:data:`Py_None`. |
| :c:data:`PyTrace_LINE` | Always :c:data:`Py_None`. |
+------------------------------+----------------------------------------+
| :const:`PyTrace_RETURN` | Value being returned to the caller, |
| :c:data:`PyTrace_RETURN` | Value being returned to the caller, |
| | or ``NULL`` if caused by an exception. |
+------------------------------+----------------------------------------+
| :const:`PyTrace_C_CALL` | Function object being called. |
| :c:data:`PyTrace_C_CALL` | Function object being called. |
+------------------------------+----------------------------------------+
| :const:`PyTrace_C_EXCEPTION` | Function object being called. |
| :c:data:`PyTrace_C_EXCEPTION`| Function object being called. |
+------------------------------+----------------------------------------+
| :const:`PyTrace_C_RETURN` | Function object being called. |
| :c:data:`PyTrace_C_RETURN` | Function object being called. |
+------------------------------+----------------------------------------+
| :const:`PyTrace_OPCODE` | Always :c:data:`Py_None`. |
| :c:data:`PyTrace_OPCODE` | Always :c:data:`Py_None`. |
+------------------------------+----------------------------------------+

.. c:var:: int PyTrace_CALL
Expand Down Expand Up @@ -1499,8 +1499,8 @@ Python-level trace functions in previous versions.
function as its first parameter, and may be any Python object, or ``NULL``. If
the profile function needs to maintain state, using a different value for *obj*
for each thread provides a convenient and thread-safe place to store it. The
profile function is called for all monitored events except :const:`PyTrace_LINE`
:const:`PyTrace_OPCODE` and :const:`PyTrace_EXCEPTION`.
profile function is called for all monitored events except :c:data:`PyTrace_LINE`
:c:data:`PyTrace_OPCODE` and :c:data:`PyTrace_EXCEPTION`.

See also the :func:`sys.setprofile` function.

Expand All @@ -1525,8 +1525,8 @@ Python-level trace functions in previous versions.
:c:func:`PyEval_SetProfile`, except the tracing function does receive line-number
events and per-opcode events, but does not receive any event related to C function
objects being called. Any trace function registered using :c:func:`PyEval_SetTrace`
will not receive :const:`PyTrace_C_CALL`, :const:`PyTrace_C_EXCEPTION` or
:const:`PyTrace_C_RETURN` as a value for the *what* parameter.
will not receive :c:data:`PyTrace_C_CALL`, :c:data:`PyTrace_C_EXCEPTION` or
:c:data:`PyTrace_C_RETURN` as a value for the *what* parameter.

See also the :func:`sys.settrace` function.

Expand Down