summaryrefslogtreecommitdiffstats
path: root/contrib/python/cffi/py3/c/call_python.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/python/cffi/py3/c/call_python.c')
-rw-r--r--contrib/python/cffi/py3/c/call_python.c17
1 files changed, 2 insertions, 15 deletions
diff --git a/contrib/python/cffi/py3/c/call_python.c b/contrib/python/cffi/py3/c/call_python.c
index 8c6703cc26b..57e5f31402f 100644
--- a/contrib/python/cffi/py3/c/call_python.c
+++ b/contrib/python/cffi/py3/c/call_python.c
@@ -1,16 +1,7 @@
-#if PY_VERSION_HEX >= 0x03080000
-# define HAVE_PYINTERPSTATE_GETDICT
-#endif
-
-
static PyObject *_current_interp_key(void)
{
PyInterpreterState *interp = PyThreadState_GET()->interp;
-#ifdef HAVE_PYINTERPSTATE_GETDICT
return PyInterpreterState_GetDict(interp); /* shared reference */
-#else
- return interp->modules;
-#endif
}
static PyObject *_get_interpstate_dict(void)
@@ -33,11 +24,7 @@ static PyObject *_get_interpstate_dict(void)
}
interp = tstate->interp;
-#ifdef HAVE_PYINTERPSTATE_GETDICT
interpdict = PyInterpreterState_GetDict(interp); /* shared reference */
-#else
- interpdict = interp->builtins;
-#endif
if (interpdict == NULL) {
/* subinterpreter was cleared already, or is being cleared right now,
to a point that is too much for us to continue */
@@ -47,7 +34,7 @@ static PyObject *_get_interpstate_dict(void)
/* from there on, we know the (sub-)interpreter is still valid */
if (attr_name == NULL) {
- attr_name = PyText_InternFromString("__cffi_backend_extern_py");
+ attr_name = PyUnicode_InternFromString("__cffi_backend_extern_py");
if (attr_name == NULL)
goto error;
}
@@ -90,7 +77,7 @@ static PyObject *_ffi_def_extern_decorator(PyObject *outer_args, PyObject *fn)
name = PyObject_GetAttrString(fn, "__name__");
if (name == NULL)
return NULL;
- s = PyText_AsUTF8(name);
+ s = PyUnicode_AsUTF8(name);
if (s == NULL) {
Py_DECREF(name);
return NULL;