Skip to content

Commit 2b0643f

Browse files
committed
Work around a crash with Python 3.12.
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. --HG-- branch : 1.9
1 parent 28b05ea commit 2b0643f

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

plugins/python/python_loghandler.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,11 @@ sudo_module_set_default_loghandler(void)
187187
Py_CLEAR(py_result);
188188
Py_CLEAR(py_logger);
189189
Py_CLEAR(py_logging_module);
190+
#if 0
191+
// XXX - If we don't leak py_loghandler here we may get a crash in
192+
// Py_EndInterpreter() on Python 3.12.
190193
Py_CLEAR(py_loghandler);
194+
#endif
191195

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

0 commit comments

Comments
 (0)