Python plugin: Call EndInterpreter when deinit'ing the plugin

This fixes https://github.com/hexchat/hexchat/issues/2237 , a
commonly-encountered bug when using Hexchat 2.14 on Python 3.7.
Thanks to @ncoghlan for the fix.

Signed-off-by: Adam Williamson <awilliam@redhat.com>
This commit is contained in:
Adam Williamson 2019-04-30 11:16:01 -07:00 committed by Patrick Griffis
parent 8e60546aea
commit ef1aad01bf

View File

@ -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;
}