On 15/10/12 19:12, Paul Ollis wrote:
On 11/10/12 01:56, Bram Moolenaar wrote:

Paul wrote:

Vim python interface bug.

<snip>

Does this also need to be changed in the Python 3 interface?  Or was it
already working correctly there?

Having had a very quick look, I think the answer is yes.
I'll do some testing to confirm and submit a suitably updated patch.

...and the answer is yes. Updated patch attached

FYI. I have been using a patched version of Vim without any problems for over a week without issues. My vim set up makes heavy use of Python.

--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
diff -r b042d04009d4 src/if_python.c
--- a/src/if_python.c	Sat Oct 06 19:10:36 2012 +0200
+++ b/src/if_python.c	Fri Oct 19 19:45:57 2012 +0100
@@ -740,9 +740,13 @@
 #else
 	PyMac_Initialize();
 #endif
-	/* initialise threads */
+	/* 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_PYTHON
 	get_exceptions();
 #endif
diff -r b042d04009d4 src/if_python3.c
--- a/src/if_python3.c	Sat Oct 06 19:10:36 2012 +0200
+++ b/src/if_python3.c	Fri Oct 19 19:45:57 2012 +0100
@@ -709,8 +709,13 @@
 #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();

Raspunde prin e-mail lui