Commit afc00fc3 authored by Thomas A Caswell's avatar Thomas A Caswell Committed by Stefan Behnel

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 c7aed328
...@@ -490,6 +490,12 @@ static int __pyx_Generator_init(void); /*proto*/ ...@@ -490,6 +490,12 @@ static int __pyx_Generator_init(void); /*proto*/
#include <structmember.h> #include <structmember.h>
#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)
......
...@@ -705,6 +705,12 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, ...@@ -705,6 +705,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
static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
const char *funcname, int c_line, const char *funcname, int c_line,
......
...@@ -1996,6 +1996,13 @@ static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, ...@@ -1996,6 +1996,13 @@ static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args,
static size_t __pyx_pyframe_localsplus_offset = 0; static size_t __pyx_pyframe_localsplus_offset = 0;
#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
// This is the long runtime version of // This is the long runtime version of
// #define __Pyx_PyFrame_GetLocalsplus(frame) ((frame)->f_localsplus) // #define __Pyx_PyFrame_GetLocalsplus(frame) ((frame)->f_localsplus)
// offsetof(PyFrameObject, f_localsplus) differs between regular C-Python and Stackless Python. // offsetof(PyFrameObject, f_localsplus) differs between regular C-Python and Stackless Python.
......
...@@ -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