Skip to content

Commit

Permalink
Work around a crash with Python 3.12.
Browse files Browse the repository at this point in the history
In sudo_module_set_default_loghandler() if we don't leak the reference
to py_loghandler we get a crash in Py_EndInterpreter() with Python
3.12.  This probably indicates a reference counting bug elsewhere.
  • Loading branch information
millert committed Jul 21, 2023
1 parent 91ea599 commit 4e6254f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions plugins/python/python_loghandler.c
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,11 @@ sudo_module_set_default_loghandler(void)
Py_CLEAR(py_result);
Py_CLEAR(py_logger);
Py_CLEAR(py_logging_module);
#if 0
// XXX - If we don't leak py_loghandler here we may get a crash in
// Py_EndInterpreter() on Python 3.12.
Py_CLEAR(py_loghandler);
#endif

debug_return_int(PyErr_Occurred() ? SUDO_RC_ERROR : SUDO_RC_OK);
}

0 comments on commit 4e6254f

Please sign in to comment.