diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2018-07-12 19:27:37 +0200 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2018-07-12 19:27:37 +0200 |
commit | de1ade02c32f3c824ee786569ac95254254a31f3 (patch) | |
tree | efc8bb819476299d3ef172cb8eccc1ee9fa56e96 | |
parent | 7554febf7e1e7dc2ec6b84007bdee438364f4dd2 (diff) | |
download | weechat-de1ade02c32f3c824ee786569ac95254254a31f3.zip |
python: fix crash when loading a script with Python >= 3.7 (closes #1219)
-rw-r--r-- | ChangeLog.adoc | 1 | ||||
-rw-r--r-- | src/plugins/python/weechat-python.c | 4 |
2 files changed, 5 insertions, 0 deletions
diff --git a/ChangeLog.adoc b/ChangeLog.adoc index 1be0bc4ba..230682e5d 100644 --- a/ChangeLog.adoc +++ b/ChangeLog.adoc @@ -58,6 +58,7 @@ Bug fixes:: * guile: fix memory leak in 7 functions returning allocated strings * php: fix return code of functions config_write_option and config_write_line * php: fix memory leak in 72 functions returning allocated strings + * python: fix crash when loading a script with Python >= 3.7 (issue #1219) * relay: fix socket creation for relay server on OpenBSD (issue #1213) * ruby: fix memory leak in 7 functions returning allocated strings * script: fix memory leak in case of invalid XML content in list of scripts 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) |