which are not available in the limited C API.
(Contributed by Victor Stinner in :issue:`46007`.)
+* The following frame functions and type are now directly available with
+ ``#include <Python.h>``, it's no longer needed to add
+ ``#include <frameobject.h>``:
+
+ * :c:func:`PyFrame_Check`
+ * :c:func:`PyFrame_GetBack`
+ * :c:func:`PyFrame_GetBuiltins`
+ * :c:func:`PyFrame_GetGenerator`
+ * :c:func:`PyFrame_GetGlobals`
+ * :c:func:`PyFrame_GetLasti`
+ * :c:func:`PyFrame_GetLocals`
+ * :c:type:`PyFrame_Type`
+
+ (Contributed by Victor Stinner in :gh:`93937`.)
+
.. _pyframeobject-3.11-hiding:
* The :c:type:`PyFrameObject` structure members have been removed from the
paths and then modify them, finish initialization and use :c:func:`PySys_GetObject`
to retrieve :data:`sys.path` as a Python list object and modify it directly.
-
Deprecated
----------
/* Standard object interface */
-PyAPI_DATA(PyTypeObject) PyFrame_Type;
-
-#define PyFrame_Check(op) Py_IS_TYPE((op), &PyFrame_Type)
-
PyAPI_FUNC(PyFrameObject *) PyFrame_New(PyThreadState *, PyCodeObject *,
PyObject *, PyObject *);
PyAPI_FUNC(int) PyFrame_FastToLocalsWithError(PyFrameObject *f);
PyAPI_FUNC(void) PyFrame_FastToLocals(PyFrameObject *);
-
-PyAPI_FUNC(PyFrameObject *) PyFrame_GetBack(PyFrameObject *frame);
-PyAPI_FUNC(PyObject *) PyFrame_GetLocals(PyFrameObject *frame);
-
-PyAPI_FUNC(PyObject *) PyFrame_GetGlobals(PyFrameObject *frame);
-PyAPI_FUNC(PyObject *) PyFrame_GetBuiltins(PyFrameObject *frame);
-
-PyAPI_FUNC(PyObject *) PyFrame_GetGenerator(PyFrameObject *frame);
-PyAPI_FUNC(int) PyFrame_GetLasti(PyFrameObject *frame);
--- /dev/null
+#ifndef Py_CPYTHON_PYFRAME_H
+# error "this header file must not be included directly"
+#endif
+
+PyAPI_DATA(PyTypeObject) PyFrame_Type;
+
+#define PyFrame_Check(op) Py_IS_TYPE((op), &PyFrame_Type)
+
+PyAPI_FUNC(PyFrameObject *) PyFrame_GetBack(PyFrameObject *frame);
+PyAPI_FUNC(PyObject *) PyFrame_GetLocals(PyFrameObject *frame);
+
+PyAPI_FUNC(PyObject *) PyFrame_GetGlobals(PyFrameObject *frame);
+PyAPI_FUNC(PyObject *) PyFrame_GetBuiltins(PyFrameObject *frame);
+
+PyAPI_FUNC(PyObject *) PyFrame_GetGenerator(PyFrameObject *frame);
+PyAPI_FUNC(int) PyFrame_GetLasti(PyFrameObject *frame);
+
PyAPI_FUNC(PyCodeObject *) PyFrame_GetCode(PyFrameObject *frame);
+#ifndef Py_LIMITED_API
+# define Py_CPYTHON_PYFRAME_H
+# include "cpython/pyframe.h"
+# undef Py_CPYTHON_PYFRAME_H
+#endif
+
#ifdef __cplusplus
}
#endif
$(srcdir)/Include/cpython/pydebug.h \
$(srcdir)/Include/cpython/pyerrors.h \
$(srcdir)/Include/cpython/pyfpe.h \
+ $(srcdir)/Include/cpython/pyframe.h \
$(srcdir)/Include/cpython/pylifecycle.h \
$(srcdir)/Include/cpython/pymem.h \
$(srcdir)/Include/cpython/pystate.h \
--- /dev/null
+The following frame functions and type are now directly available with
+``#include <Python.h>``, it's no longer needed to add ``#include
+<frameobject.h>``:
+
+* :c:func:`PyFrame_Check`
+* :c:func:`PyFrame_GetBack`
+* :c:func:`PyFrame_GetBuiltins`
+* :c:func:`PyFrame_GetGenerator`
+* :c:func:`PyFrame_GetGlobals`
+* :c:func:`PyFrame_GetLasti`
+* :c:func:`PyFrame_GetLocals`
+* :c:type:`PyFrame_Type`
+
+Patch by Victor Stinner.
#endif
#include "pycore_call.h" // _PyObject_CallNoArgs()
-#include "frameobject.h"
#include <stdbool.h>
#define PY_SSIZE_T_CLEAN
#include "Python.h"
-#include "frameobject.h" // PyFrame_Check()
#include "datetime.h" // PyDateTimeAPI
#include "marshal.h" // PyMarshal_WriteLongToFile
#include "structmember.h" // PyMemberDef
#endif
#include "Python.h"
-#include "frameobject.h"
#include "pycore_frame.h"
#include "pycore_pystate.h" // _PyThreadState_GET()
#include "pycore_interpreteridobject.h"
#include "pycore_signal.h" // Py_NSIG
#include "pycore_traceback.h" // _Py_DumpTracebackThreads
-#include "frameobject.h"
-
#include <object.h>
#include <signal.h>
#include <signal.h>
#include <ctype.h>
#include "structmember.h" // PyMemberDef
-#include "frameobject.h"
#include "expat.h"
#include "pyexpat.h"
#include "pycore_symtable.h" // PySTEntry_Type
#include "pycore_typeobject.h" // _PyTypes_InitSlotDefs()
#include "pycore_unionobject.h" // _PyUnion_Type
-#include "frameobject.h" // PyFrame_Type
#include "pycore_interpreteridobject.h" // _PyInterpreterID_Type
#ifdef Py_LIMITED_API
#include "pycore_pystate.h" // _PyThreadState_GET()
#include "pycore_typeobject.h" // struct type_cache
#include "pycore_unionobject.h" // _Py_union_type_or
-#include "frameobject.h" // PyFrameObject
#include "pycore_frame.h" // _PyInterpreterFrame
#include "opcode.h" // MAKE_CELL
#include "structmember.h" // PyMemberDef
<ClInclude Include="..\Include\cpython\pydebug.h" />
<ClInclude Include="..\Include\cpython\pyerrors.h" />
<ClInclude Include="..\Include\cpython\pyfpe.h" />
+ <ClInclude Include="..\Include\cpython\pyframe.h" />
<ClInclude Include="..\Include\cpython\pylifecycle.h" />
<ClInclude Include="..\Include\cpython\pymem.h" />
<ClInclude Include="..\Include\cpython\pystate.h" />
<ClInclude Include="..\Include\cpython\pymem.h">
<Filter>Include\cpython</Filter>
</ClInclude>
+ <ClInclude Include="..\Include\cpython\pyframe.h">
+ <Filter>Include\cpython</Filter>
+ </ClInclude>
<ClInclude Include="..\Include\cpython\pylifecycle.h">
<Filter>Include\cpython</Filter>
</ClInclude>
#include "pycore_long.h" // _PyLong_GetZero()
#include "pycore_pyerrors.h"
#include "pycore_pystate.h" // _PyThreadState_GET()
-#include "frameobject.h" // PyFrame_GetBack()
#include "pycore_frame.h"
#include "clinic/_warnings.c.h"
#include "pycore_dict.h"
#include "dictobject.h"
-#include "frameobject.h"
#include "pycore_frame.h"
#include "opcode.h"
#include "pydtrace.h"
#include "Python.h"
#include "frameobject.h"
-#include "pycore_code.h" // stats
+#include "pycore_code.h" // stats
#include "pycore_frame.h"
#include "pycore_object.h" // _PyObject_GC_UNTRACK()
#include "opcode.h"
#include "Python.h"
-#include "frameobject.h"
#include "pycore_frame.h"
#include "pycore_pyerrors.h"
#include "pycore_structseq.h" // _PyStructSequence_InitType()
#include "pycore_tuple.h" // _PyTuple_FromArray()
-#include "frameobject.h" // PyFrame_GetBack()
+#include "frameobject.h" // PyFrame_FastToLocalsWithError()
#include "pydtrace.h"
#include "osdefs.h" // DELIM
#include "stdlib_module_names.h" // _Py_stdlib_module_names
#include "Python.h"
-#include "frameobject.h" // PyFrame_GetBack()
#include "pycore_ast.h" // asdl_seq_*
#include "pycore_call.h" // _PyObject_CallMethodFormat()
#include "pycore_compile.h" // _PyAST_Optimize
#include "pycore_pyerrors.h" // _PyErr_Fetch()
#include "pycore_pystate.h" // _PyThreadState_GET()
#include "pycore_traceback.h" // EXCEPTION_TB_HEADER
+
#include "../Parser/pegen.h" // _PyPegen_byte_offset_to_character_offset()
+#include "frameobject.h" // PyFrame_New()
#include "structmember.h" // PyMemberDef
#include "osdefs.h" // SEP
#ifdef HAVE_FCNTL_H