Commit 7537910a authored by Thomas A Caswell's avatar Thomas A Caswell Committed by GitHub

Import internal CPython frame header file in Python 3.11 (GH-4667)

In https://github.com/python/cpython/pull/31530
https://bugs.python.org/issue46836

the `_frame` struct was moved to an internal header, however the public API is
primarily read-only, and Cython needs to build PyFrameObjects so still import
the internal headers.

Also sets the Py_BUILD_CORE define for py311a6, trying to restrict it to the frame header.
parent 024dcf63
...@@ -499,6 +499,12 @@ static int __pyx_Generator_init(PyObject *module); /*proto*/ ...@@ -499,6 +499,12 @@ static int __pyx_Generator_init(PyObject *module); /*proto*/
//@requires: ModuleSetupCode.c::IncludeStructmemberH //@requires: ModuleSetupCode.c::IncludeStructmemberH
#include <frameobject.h> #include <frameobject.h>
#if PY_VERSION_HEX >= 0x030b00a6
#ifndef Py_BUILD_CORE
#define Py_BUILD_CORE 1
#endif
#include "internal/pycore_frame.h"
#endif
#define __Pyx_Coroutine_Undelegate(gen) Py_CLEAR((gen)->yieldfrom) #define __Pyx_Coroutine_Undelegate(gen) Py_CLEAR((gen)->yieldfrom)
......
...@@ -785,6 +785,12 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, ...@@ -785,6 +785,12 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line,
#include "compile.h" #include "compile.h"
#include "frameobject.h" #include "frameobject.h"
#include "traceback.h" #include "traceback.h"
#if PY_VERSION_HEX >= 0x030b00a6
#ifndef Py_BUILD_CORE
#define Py_BUILD_CORE 1
#endif
#include "internal/pycore_frame.h"
#endif
#if CYTHON_COMPILING_IN_LIMITED_API #if CYTHON_COMPILING_IN_LIMITED_API
static void __Pyx_AddTraceback(const char *funcname, int c_line, static void __Pyx_AddTraceback(const char *funcname, int c_line,
......
...@@ -2444,6 +2444,12 @@ static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, ...@@ -2444,6 +2444,12 @@ static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args,
#if !CYTHON_VECTORCALL #if !CYTHON_VECTORCALL
#if PY_VERSION_HEX >= 0x03080000 #if PY_VERSION_HEX >= 0x03080000
#include "frameobject.h" #include "frameobject.h"
#if PY_VERSION_HEX >= 0x030b00a6
#ifndef Py_BUILD_CORE
#define Py_BUILD_CORE 1
#endif
#include "internal/pycore_frame.h"
#endif
#define __Pxy_PyFrame_Initialize_Offsets() #define __Pxy_PyFrame_Initialize_Offsets()
#define __Pyx_PyFrame_GetLocalsplus(frame) ((frame)->f_localsplus) #define __Pyx_PyFrame_GetLocalsplus(frame) ((frame)->f_localsplus)
#else #else
...@@ -3106,5 +3112,3 @@ static CYTHON_INLINE void __Pyx_RaiseCppAttributeError(const char *varname); /*p ...@@ -3106,5 +3112,3 @@ static CYTHON_INLINE void __Pyx_RaiseCppAttributeError(const char *varname); /*p
static CYTHON_INLINE void __Pyx_RaiseCppAttributeError(const char *varname) { static CYTHON_INLINE void __Pyx_RaiseCppAttributeError(const char *varname) {
PyErr_Format(PyExc_AttributeError, "C++ attribute '%s' is not initialized", varname); PyErr_Format(PyExc_AttributeError, "C++ attribute '%s' is not initialized", varname);
} }
...@@ -38,6 +38,12 @@ ...@@ -38,6 +38,12 @@
#include "compile.h" #include "compile.h"
#include "frameobject.h" #include "frameobject.h"
#include "traceback.h" #include "traceback.h"
#if PY_VERSION_HEX >= 0x030b00a6
#ifndef Py_BUILD_CORE
#define Py_BUILD_CORE 1
#endif
#include "internal/pycore_frame.h"
#endif
#if CYTHON_PROFILE_REUSE_FRAME #if CYTHON_PROFILE_REUSE_FRAME
#define CYTHON_FRAME_MODIFIER static #define CYTHON_FRAME_MODIFIER static
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment