summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorPeter Bierma <zintensitydev@gmail.com>2024-12-11 16:28:44 (GMT)
committerGitHub <noreply@github.com>2024-12-11 16:28:44 (GMT)
commitdd9da738ad1d420fabafaded3fe63912b2b17cfb (patch)
tree63e0ed0a70b6812b6ae906e73bcf0f953cf13939 /Doc
parentb0f278ff0551b06191cec01445c577e3b25570da (diff)
downloadcpython-dd9da738ad1d420fabafaded3fe63912b2b17cfb.zip
cpython-dd9da738ad1d420fabafaded3fe63912b2b17cfb.tar.gz
cpython-dd9da738ad1d420fabafaded3fe63912b2b17cfb.tar.bz2
gh-118915: C API: Document frame locals proxies. (#127720)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Diffstat (limited to 'Doc')
-rw-r--r--Doc/c-api/frame.rst22
1 files changed, 21 insertions, 1 deletions
diff --git a/Doc/c-api/frame.rst b/Doc/c-api/frame.rst
index 638a740..1a52e14 100644
--- a/Doc/c-api/frame.rst
+++ b/Doc/c-api/frame.rst
@@ -132,7 +132,7 @@ See also :ref:`Reflection <reflection>`.
.. versionadded:: 3.11
.. versionchanged:: 3.13
- As part of :pep:`667`, return a proxy object for optimized scopes.
+ As part of :pep:`667`, return an instance of :c:var:`PyFrameLocalsProxy_Type`.
.. c:function:: int PyFrame_GetLineNumber(PyFrameObject *frame)
@@ -140,6 +140,26 @@ See also :ref:`Reflection <reflection>`.
Return the line number that *frame* is currently executing.
+Frame Locals Proxies
+^^^^^^^^^^^^^^^^^^^^
+
+.. versionadded:: 3.13
+
+The :attr:`~frame.f_locals` attribute on a :ref:`frame object <frame-objects>`
+is an instance of a "frame-locals proxy". The proxy object exposes a
+write-through view of the underlying locals dictionary for the frame. This
+ensures that the variables exposed by ``f_locals`` are always up to date with
+the live local variables in the frame itself.
+
+See :pep:`667` for more information.
+
+.. c:var:: PyTypeObject PyFrameLocalsProxy_Type
+
+ The type of frame :func:`locals` proxy objects.
+
+.. c:function:: int PyFrameLocalsProxy_Check(PyObject *obj)
+
+ Return non-zero if *obj* is a frame :func:`locals` proxy.
Internal Frames
^^^^^^^^^^^^^^^