summaryrefslogtreecommitdiff
path: root/src/if_python3.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2012-10-21 01:47:00 +0200
committerBram Moolenaar <Bram@vim.org>2012-10-21 01:47:00 +0200
commit003d14a26771bf7d2c05013cd2fd9d2622f373b9 (patch)
tree45e175aff33fa0eefe1aeded6b75c37abccbf4b4 /src/if_python3.c
parentc4b98fbb3ea881621d051f84d67609f6789880bc (diff)
downloadvim-git-003d14a26771bf7d2c05013cd2fd9d2622f373b9.tar.gz
updated for version 7.3.698v7.3.698
Problem: Python 3 does not preserve state beween commands. Solution: Preserve the state. (Paul Ollis)
Diffstat (limited to 'src/if_python3.c')
-rw-r--r--src/if_python3.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/if_python3.c b/src/if_python3.c
index ea59a4233..e9f7400f8 100644
--- a/src/if_python3.c
+++ b/src/if_python3.c
@@ -731,8 +731,12 @@ Python3_Init(void)
#else
PyMac_Initialize();
#endif
- /* initialise threads, must be after Py_Initialize() */
+ /* Initialise threads, and save the state using PyGILState_Ensure.
+ * Without the call to PyGILState_Ensure, thread specific state (such
+ * as the system trace hook), will be lost between invocations of
+ * Python code. */
PyEval_InitThreads();
+ pygilstate = PyGILState_Ensure();
#ifdef DYNAMIC_PYTHON3
get_py3_exceptions();