Porting Py3.8/Py3.9:
Since Py3.3: 'Py_ssize_t PyUnicode_GetSize(PyObject*)' is deprecated [-Wdeprecated-declarations] Since Py3.9: 'PyObject* PyEval_CallObjectWithKeywords(PyObject*, PyObject*, PyObject*)' is deprecated [-Wdeprecated-declarations] Since Py3.9: 'void PyEval_InitThreads()' is deprecated [-Wdeprecated-declarations]
This commit is contained in:
@@ -549,7 +549,11 @@ const char* InterpreterSingleton::init(int argc,char *argv[])
|
||||
" exec(open(activate_this).read(), {'__file__':activate_this})\n"
|
||||
);
|
||||
}
|
||||
|
||||
#if PY_VERSION_HEX < 0x03090000
|
||||
PyEval_InitThreads();
|
||||
#endif
|
||||
|
||||
#if PY_MAJOR_VERSION >= 3
|
||||
size_t size = argc;
|
||||
wchar_t **_argv = new wchar_t*[size];
|
||||
@@ -700,7 +704,11 @@ void InterpreterSingleton::runMethod(PyObject *pobject, const char *method,
|
||||
throw TypeError("InterpreterSingleton::RunMethod() wrong arguments");
|
||||
}
|
||||
|
||||
#if PY_VERSION_HEX < 0x03090000
|
||||
presult = PyEval_CallObject(pmeth, pargs); /* run interpreter */
|
||||
#else
|
||||
presult = PyObject_CallObject(pmeth, pargs); /* run interpreter */
|
||||
#endif
|
||||
|
||||
Py_DECREF(pmeth);
|
||||
Py_DECREF(pargs);
|
||||
|
||||
@@ -58,7 +58,11 @@ PP_Run_Method(PyObject *pobject, const char *method,
|
||||
if (PP_DEBUG) /* debug it too? */
|
||||
presult = PP_Debug_Function(pmeth, pargs);
|
||||
else
|
||||
#if PY_VERSION_HEX < 0x03090000
|
||||
presult = PyEval_CallObject(pmeth, pargs); /* run interpreter */
|
||||
#else
|
||||
presult = PyObject_CallObject(pmeth, pargs); /* run interpreter */
|
||||
#endif
|
||||
|
||||
Py_DECREF(pmeth);
|
||||
Py_DECREF(pargs);
|
||||
@@ -133,7 +137,11 @@ PP_Run_Function(const char *modname, const char *funcname, /* load from
|
||||
if (PP_DEBUG && strcmp(modname, "pdb") != 0) /* debug this call? */
|
||||
presult = PP_Debug_Function(func, args); /* run in pdb; incref'd */
|
||||
else
|
||||
#if PY_VERSION_HEX < 0x03090000
|
||||
presult = PyEval_CallObject(func, args); /* run function; incref'd */
|
||||
#else
|
||||
presult = PyObject_CallObject(func, args); /* run function; incref'd */
|
||||
#endif
|
||||
|
||||
Py_DECREF(func);
|
||||
Py_DECREF(args); /* result may be None */
|
||||
@@ -185,7 +193,11 @@ PP_Run_Known_Callable(PyObject *object, /* func|class|method */
|
||||
if (PP_DEBUG) /* debug this call? */
|
||||
presult = PP_Debug_Function(object, args); /* run in pdb; incref'd */
|
||||
else
|
||||
#if PY_VERSION_HEX < 0x03090000
|
||||
presult = PyEval_CallObject(object, args); /* run function; incref'd */
|
||||
#else
|
||||
presult = PyObject_CallObject(object, args); /* run function; incref'd */
|
||||
#endif
|
||||
|
||||
Py_DECREF(args); /* result may be None */
|
||||
return PP_Convert_Result(presult, resfmt, cresult); /* convert result to C*/
|
||||
|
||||
Reference in New Issue
Block a user