From 28b05ea8f95bada8b2b8d4e4614c210553e3fd56 Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Fri, 21 Jul 2023 10:47:28 -0600 Subject: [PATCH] Use PyObject_CallNoArgs() where possible. --HG-- branch : 1.9 --- plugins/python/python_loghandler.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/plugins/python/python_loghandler.c b/plugins/python/python_loghandler.c index fca232059..f43fe8cd6 100644 --- a/plugins/python/python_loghandler.c +++ b/plugins/python/python_loghandler.c @@ -23,6 +23,10 @@ #include "sudo_python_module.h" +#if PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION < 9 +# define PyObject_CallNoArgs(_o) PyObject_CallObject((_o), NULL) +#endif + static PyObject *sudo_type_LogHandler; static void @@ -165,7 +169,7 @@ sudo_module_set_default_loghandler(void) PyObject *py_loghandler = NULL, *py_logging_module = NULL, *py_logger = NULL, *py_result = NULL; - py_loghandler = PyObject_CallObject(sudo_type_LogHandler, NULL); + py_loghandler = PyObject_CallNoArgs(sudo_type_LogHandler); if (py_loghandler == NULL) goto cleanup;