Skip to content

Commit 86513f6

Browse files
pythongh-141004: Document missing frame APIs (pythonGH-141189)
Co-authored-by: Stan Ulbrych <[email protected]>
1 parent ed0a5fd commit 86513f6

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed

Doc/c-api/frame.rst

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@ See also :ref:`Reflection <reflection>`.
2929
Previously, this type was only available after including
3030
``<frameobject.h>``.
3131

32+
.. c:function:: PyFrameObject *PyFrame_New(PyThreadState *tstate, PyCodeObject *code, PyObject *globals, PyObject *locals)
33+
34+
Create a new frame object. This function returns a :term:`strong reference`
35+
to the new frame object on success, and returns ``NULL`` with an exception
36+
set on failure.
37+
3238
.. c:function:: int PyFrame_Check(PyObject *obj)
3339
3440
Return non-zero if *obj* is a frame object.
@@ -161,6 +167,57 @@ See :pep:`667` for more information.
161167
162168
Return non-zero if *obj* is a frame :func:`locals` proxy.
163169
170+
171+
Legacy Local Variable APIs
172+
^^^^^^^^^^^^^^^^^^^^^^^^^^
173+
174+
These APIs are :term:`soft deprecated`. As of Python 3.13, they do nothing.
175+
They exist solely for backwards compatibility.
176+
177+
178+
.. c:function:: void PyFrame_LocalsToFast(PyFrameObject *f, int clear)
179+
180+
This function is :term:`soft deprecated` and does nothing.
181+
182+
Prior to Python 3.13, this function would copy the :attr:`~frame.f_locals`
183+
attribute of *f* to the internal "fast" array of local variables, allowing
184+
changes in frame objects to be visible to the interpreter. If *clear* was
185+
true, this function would process variables that were unset in the locals
186+
dictionary.
187+
188+
.. versionchanged:: 3.13
189+
This function now does nothing.
190+
191+
192+
.. c:function:: void PyFrame_FastToLocals(PyFrameObject *f)
193+
194+
This function is :term:`soft deprecated` and does nothing.
195+
196+
Prior to Python 3.13, this function would copy the internal "fast" array
197+
of local variables (which is used by the interpreter) to the
198+
:attr:`~frame.f_locals` attribute of *f*, allowing changes in local
199+
variables to be visible to frame objects.
200+
201+
.. versionchanged:: 3.13
202+
This function now does nothing.
203+
204+
205+
.. c:function:: int PyFrame_FastToLocalsWithError(PyFrameObject *f)
206+
207+
This function is :term:`soft deprecated` and does nothing.
208+
209+
Prior to Python 3.13, this function was similar to
210+
:c:func:`PyFrame_FastToLocals`, but would return ``0`` on success, and
211+
``-1`` with an exception set on failure.
212+
213+
.. versionchanged:: 3.13
214+
This function now does nothing.
215+
216+
217+
.. seealso::
218+
:pep:`667`
219+
220+
164221
Internal Frames
165222
^^^^^^^^^^^^^^^
166223

0 commit comments

Comments
 (0)