Skip to content

Commit 606869b

Browse files
ZeroIntensityAlexWaygood
authored andcommitted
pythongh-118915: C API: Document frame locals proxies. (python#127720)
Co-authored-by: Alex Waygood <[email protected]>
1 parent 05af03a commit 606869b

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

Doc/c-api/frame.rst

+21-1
Original file line numberDiff line numberDiff line change
@@ -132,14 +132,34 @@ See also :ref:`Reflection <reflection>`.
132132
.. versionadded:: 3.11
133133
134134
.. versionchanged:: 3.13
135-
As part of :pep:`667`, return a proxy object for optimized scopes.
135+
As part of :pep:`667`, return an instance of :c:var:`PyFrameLocalsProxy_Type`.
136136
137137
138138
.. c:function:: int PyFrame_GetLineNumber(PyFrameObject *frame)
139139
140140
Return the line number that *frame* is currently executing.
141141
142142
143+
Frame Locals Proxies
144+
^^^^^^^^^^^^^^^^^^^^
145+
146+
.. versionadded:: 3.13
147+
148+
The :attr:`~frame.f_locals` attribute on a :ref:`frame object <frame-objects>`
149+
is an instance of a "frame-locals proxy". The proxy object exposes a
150+
write-through view of the underlying locals dictionary for the frame. This
151+
ensures that the variables exposed by ``f_locals`` are always up to date with
152+
the live local variables in the frame itself.
153+
154+
See :pep:`667` for more information.
155+
156+
.. c:var:: PyTypeObject PyFrameLocalsProxy_Type
157+
158+
The type of frame :func:`locals` proxy objects.
159+
160+
.. c:function:: int PyFrameLocalsProxy_Check(PyObject *obj)
161+
162+
Return non-zero if *obj* is a frame :func:`locals` proxy.
143163
144164
Internal Frames
145165
^^^^^^^^^^^^^^^

0 commit comments

Comments
 (0)