mirror of
https://github.com/python/cpython.git
synced 2025-08-03 08:34:29 +00:00
gh-92154: Expose PyCode_GetCode in the C API (GH-92168)
This commit is contained in:
parent
1d4a9a45b7
commit
6c7249f265
6 changed files with 53 additions and 0 deletions
|
@ -76,3 +76,17 @@ bound into a function.
|
|||
information is not available for any particular element.
|
||||
|
||||
Returns ``1`` if the function succeeds and 0 otherwise.
|
||||
|
||||
.. c:function:: PyObject* PyCode_GetCode(PyCodeObject *co)
|
||||
|
||||
Equivalent to the Python code ``getattr(co, 'co_code')``.
|
||||
Returns a strong reference to a :c:type:`PyBytesObject` representing the
|
||||
bytecode in a code object. On error, ``NULL`` is returned and an exception
|
||||
is raised.
|
||||
|
||||
This ``PyBytesObject`` may be created on-demand by the interpreter and does
|
||||
not necessarily represent the bytecode actually executed by CPython. The
|
||||
primary use case for this function is debuggers and profilers.
|
||||
|
||||
.. versionadded:: 3.11
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue