@@ -11,3 +11,58 @@ index 2cdb76b..ab91032 100644
1111 nargs = PyTuple_GET_SIZE(fargs);
1212 #if defined(MS_WIN32) && !defined(_WIN64)
1313 if (fabi == FFI_STDCALL)
14+ diff --git a/c/lib_obj.c b/c/lib_obj.c
15+ index 38bf3d5..9954f3b 100644
16+ --- a/c/lib_obj.c
17+ +++ b/c/lib_obj.c
18+ @@ -46,10 +46,10 @@ static struct CPyExtFunc_s *_cpyextfunc_get(PyObject *x)
19+
20+ fo = (PyCFunctionObject *)x;
21+ lo = (LibObject *)y;
22+ - if (lo->l_libname != fo->m_module)
23+ + if (lo->l_libname != _PyCFunction_GetModule(fo))
24+ return NULL;
25+
26+ - return (struct CPyExtFunc_s *)(fo->m_ml);
27+ + return (struct CPyExtFunc_s *)(_PyCFunction_GetMethodDef(fo));
28+ }
29+
30+ static PyObject *_cpyextfunc_type(LibObject *lib, struct CPyExtFunc_s *exf)
31+ diff --git a/c/misc_thread_common.h b/c/misc_thread_common.h
32+ index 66e2835..bc32b1b 100644
33+ --- a/c/misc_thread_common.h
34+ +++ b/c/misc_thread_common.h
35+ @@ -329,6 +329,7 @@ static PyThreadState *get_current_ts(void)
36+
37+ static PyGILState_STATE gil_ensure(void)
38+ {
39+ + return PyGILState_Ensure();
40+ /* Called at the start of a callback. Replacement for
41+ PyGILState_Ensure().
42+ */
43+ diff --git a/cffi/_cffi_include.h b/cffi/_cffi_include.h
44+ index e4c0a67..53b7d06 100644
45+ --- a/cffi/_cffi_include.h
46+ +++ b/cffi/_cffi_include.h
47+ @@ -121,7 +121,7 @@ extern "C" {
48+ #endif
49+
50+ /********** CPython-specific section **********/
51+ - #ifndef PYPY_VERSION
52+ + #if !defined(PYPY_VERSION) && !defined(GRAALVM_PYTHON)
53+
54+
55+ #if PY_MAJOR_VERSION >= 3
56+ diff --git a/cffi/_embedding.h b/cffi/_embedding.h
57+ index 8e8df88..90fdcd6 100644
58+ --- a/cffi/_embedding.h
59+ +++ b/cffi/_embedding.h
60+ @@ -113,7 +113,7 @@ static void _cffi_release_reentrant_mutex(void)
61+
62+
63+ /********** CPython-specific section **********/
64+ - #ifndef PYPY_VERSION
65+ + #if !defined(PYPY_VERSION) && !defined(GRAALVM_PYTHON)
66+
67+ #include "_cffi_errors.h"
68+
0 commit comments