mirror of
https://github.com/python/cpython.git
synced 2025-11-25 21:11:09 +00:00
bpo-40421: Add missing getters for frame object attributes to C-API. (GH-32114)
This commit is contained in:
parent
44e915028d
commit
74b95d86e0
7 changed files with 136 additions and 4 deletions
|
|
@ -30,6 +30,17 @@ See also :ref:`Reflection <reflection>`.
|
|||
.. versionadded:: 3.9
|
||||
|
||||
|
||||
.. c:function:: PyObject* PyFrame_GetBuiltins(PyFrameObject *frame)
|
||||
|
||||
Get the *frame*'s ``f_builtins`` attribute.
|
||||
|
||||
Return a :term:`strong reference`. The result cannot be ``NULL``.
|
||||
|
||||
*frame* must not be ``NULL``.
|
||||
|
||||
.. versionadded:: 3.11
|
||||
|
||||
|
||||
.. c:function:: PyCodeObject* PyFrame_GetCode(PyFrameObject *frame)
|
||||
|
||||
Get the *frame* code.
|
||||
|
|
@ -41,6 +52,30 @@ See also :ref:`Reflection <reflection>`.
|
|||
.. versionadded:: 3.9
|
||||
|
||||
|
||||
.. c:function:: PyObject* PyFrame_GetGenerator(PyFrameObject *frame)
|
||||
|
||||
Get the generator, coroutine, or async generator that owns this frame,
|
||||
or ``NULL`` if this frame is not owned by a generator.
|
||||
Does not raise an exception, even if the return value is ``NULL``.
|
||||
|
||||
Return a :term:`strong reference`, or ``NULL``.
|
||||
|
||||
*frame* must not be ``NULL``.
|
||||
|
||||
.. versionadded:: 3.11
|
||||
|
||||
|
||||
.. c:function:: PyObject* PyFrame_GetGlobals(PyFrameObject *frame)
|
||||
|
||||
Get the *frame*'s ``f_globals`` attribute.
|
||||
|
||||
Return a :term:`strong reference`. The result cannot be ``NULL``.
|
||||
|
||||
*frame* must not be ``NULL``.
|
||||
|
||||
.. versionadded:: 3.11
|
||||
|
||||
|
||||
.. c:function:: PyObject* PyFrame_GetLocals(PyFrameObject *frame)
|
||||
|
||||
Get the *frame*'s ``f_locals`` attribute (:class:`dict`).
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue