- Fix for Python 3.9, no longer use deprecated functions of

PyEval_CallObject (now PyObject_Call), PyEval_InitThreads (now
  none), PyParser_SimpleParseFile (now Py_CompileString).
This commit is contained in:
W.C.A. Wijngaards
2021-02-09 10:38:55 +01:00
parent 450155bfa0
commit e0d426ebb1
3 changed files with 52 additions and 0 deletions
+6
View File
@@ -916,7 +916,13 @@ int _ub_resolve_async(struct ub_ctx* ctx, char* name, int rrtype, int rrclass, v
struct cb_data* id;
id = (struct cb_data*) iddata;
arglist = Py_BuildValue("(OiO)",id->data,status, SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ub_result, 0 | 0 )); // Build argument list
#if PY_MAJOR_VERSION <= 2 || (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION < 9)
/* for python before 3.9 */
fresult = PyEval_CallObject(id->func,arglist); // Call Python
#else
/* for python 3.9 and newer */
fresult = PyObject_Call(id->func,arglist,NULL);
#endif
Py_DECREF(id->func);
Py_DECREF(id->data);
free(id);