Skip to content

Commit

Permalink
FIX: import internal cpython headers to fix for py311
Browse files Browse the repository at this point in the history
In 18b5dd68c6b616257ae243c0b6bb965ffc885a23 /
python/cpython#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 _frame objects so still import
the internal headers.
  • Loading branch information
tacaswell committed Mar 4, 2022
1 parent 11a9e73 commit a83fbaa
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 2 deletions.
3 changes: 3 additions & 0 deletions Cython/Utility/Coroutine.c
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,9 @@ static int __pyx_Generator_init(PyObject *module); /*proto*/
//@requires: ModuleSetupCode.c::IncludeStructmemberH

#include <frameobject.h>
#if PY_VERSION_HEX >= 0x030b00a6
#include "internal/pycore_frame.h"
#endif

#define __Pyx_Coroutine_Undelegate(gen) Py_CLEAR((gen)->yieldfrom)

Expand Down
3 changes: 3 additions & 0 deletions Cython/Utility/Exceptions.c
Original file line number Diff line number Diff line change
Expand Up @@ -784,6 +784,9 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line,

#include "compile.h"
#include "frameobject.h"
#if PY_VERSION_HEX >= 0x030b00a6
#include "internal/pycore_frame.h"
#endif
#include "traceback.h"

#if CYTHON_COMPILING_IN_LIMITED_API
Expand Down
5 changes: 3 additions & 2 deletions Cython/Utility/ObjectHandling.c
Original file line number Diff line number Diff line change
Expand Up @@ -2444,6 +2444,9 @@ static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args,
#if !CYTHON_VECTORCALL
#if PY_VERSION_HEX >= 0x03080000
#include "frameobject.h"
#if PY_VERSION_HEX >= 0x030b00a6
#include "internal/pycore_frame.h"
#endif
#define __Pxy_PyFrame_Initialize_Offsets()
#define __Pyx_PyFrame_GetLocalsplus(frame) ((frame)->f_localsplus)
#else
Expand Down Expand Up @@ -3106,5 +3109,3 @@ static CYTHON_INLINE void __Pyx_RaiseCppAttributeError(const char *varname); /*p
static CYTHON_INLINE void __Pyx_RaiseCppAttributeError(const char *varname) {
PyErr_Format(PyExc_AttributeError, "C++ attribute '%s' is not initialized", varname);
}


3 changes: 3 additions & 0 deletions Cython/Utility/Profile.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@

#include "compile.h"
#include "frameobject.h"
#if PY_VERSION_HEX >= 0x030b00a6
#include "internal/pycore_frame.h"
#endif
#include "traceback.h"

#if CYTHON_PROFILE_REUSE_FRAME
Expand Down

0 comments on commit a83fbaa

Please sign in to comment.