diff --git a/plugins/python/python.c b/plugins/python/python.c index 4403474d..475756ba 100644 --- a/plugins/python/python.c +++ b/plugins/python/python.c @@ -2806,6 +2806,9 @@ hexchat_plugin_deinit(void) xchatout_buffer = NULL; if (interp_plugin) { + PyThreadState *tstate = ((PluginObject*)interp_plugin)->tstate; + PyThreadState_Swap(tstate); + Py_EndInterpreter(tstate); Py_DECREF(interp_plugin); interp_plugin = NULL; }