summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2018-07-12 19:27:37 +0200
committerSébastien Helleu <flashcode@flashtux.org>2018-07-12 19:27:37 +0200
commitde1ade02c32f3c824ee786569ac95254254a31f3 (patch)
treeefc8bb819476299d3ef172cb8eccc1ee9fa56e96 /src
parent7554febf7e1e7dc2ec6b84007bdee438364f4dd2 (diff)
downloadweechat-de1ade02c32f3c824ee786569ac95254254a31f3.zip
python: fix crash when loading a script with Python >= 3.7 (closes #1219)
Diffstat (limited to 'src')
-rw-r--r--src/plugins/python/weechat-python.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/plugins/python/weechat-python.c b/src/plugins/python/weechat-python.c
index bbb10e95f..8ae89da93 100644
--- a/src/plugins/python/weechat-python.c
+++ b/src/plugins/python/weechat-python.c
@@ -1561,7 +1561,11 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
/* PyEval_InitThreads(); */
/* python_mainThreadState = PyThreadState_Swap(NULL); */
+#if PY_VERSION_HEX >= 0x03070000
+ python_mainThreadState = PyThreadState_Get();
+#else
python_mainThreadState = PyEval_SaveThread();
+#endif
/* PyEval_ReleaseLock (); */
if (!python_mainThreadState)