Fix deprecation warnings

This commit is contained in:
Stuart D. Gathman
2021-12-15 23:35:02 -05:00
parent 7a5c942d54
commit 102e042a38
+4 -1
View File
@@ -491,7 +491,7 @@ _generic_wrapper(milter_ContextObject *self, PyObject *cb, PyObject *arglist) {
int retval; int retval;
if (arglist == NULL) return _report_exception(self); if (arglist == NULL) return _report_exception(self);
result = PyEval_CallObject(cb, arglist); result = PyObject_CallObject(cb, arglist);
Py_DECREF(arglist); Py_DECREF(arglist);
if (result == NULL) return _report_exception(self); if (result == NULL) return _report_exception(self);
#if PY_MAJOR_VERSION >= 3 #if PY_MAJOR_VERSION >= 3
@@ -904,7 +904,10 @@ milter_main(PyObject *self, PyObject *args) {
return NULL; return NULL;
} }
/* libmilter requires thread support */ /* libmilter requires thread support */
#if PY_VERSION_HEX < 0x03070000
/* called in Py_Initialize beginning with 3.7 */
PyEval_InitThreads(); PyEval_InitThreads();
#endif
/* let other threads run while in smfi_main() */ /* let other threads run while in smfi_main() */
interp = PyThreadState_Get()->interp; interp = PyThreadState_Get()->interp;
_main = PyEval_SaveThread(); /* must be done before smfi_main() */ _main = PyEval_SaveThread(); /* must be done before smfi_main() */