]> granicus.if.org Git - vim/commitdiff
updated for version 7.3.786 v7.3.786
authorBram Moolenaar <Bram@vim.org>
Wed, 30 Jan 2013 10:44:39 +0000 (11:44 +0100)
committerBram Moolenaar <Bram@vim.org>
Wed, 30 Jan 2013 10:44:39 +0000 (11:44 +0100)
Problem:    Python threads don't run in the background (issue 103).
Solution:   Move the statements to manipulate thread state.

src/if_python.c
src/version.c

index 5e792b16d1397d57bb609a1dc9c5f10c9db59d5d..1bf737fc4c27d1e2ccc016b8a4ffe32090d342d6 100644 (file)
@@ -740,12 +740,11 @@ Python_Init(void)
 #else
        PyMac_Initialize();
 #endif
-       /* 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. */
+       /* Initialise threads, and below 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
@@ -756,6 +755,10 @@ Python_Init(void)
        if (PythonMod_Init())
            goto fail;
 
+       /* The first python thread is vim's, release the lock. */
+       Python_SaveThread();
+       pygilstate = PyGILState_Ensure();
+
        globals = PyModule_GetDict(PyImport_AddModule("__main__"));
 
        /* Remove the element from sys.path that was added because of our
@@ -764,8 +767,7 @@ Python_Init(void)
         * the current directory in sys.path. */
        PyRun_SimpleString("import sys; sys.path = filter(lambda x: x != '/must>not&exist', sys.path)");
 
-       /* the first python thread is vim's, release the lock */
-       Python_SaveThread();
+       PyGILState_Release(pygilstate);
 
        initialised = 1;
     }
index 0f77ad25571029641eb1fdf60f33027378be0ea5..8115020bf3305c0485abffa73bd52c2840826014 100644 (file)
@@ -725,6 +725,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    786,
 /**/
     785,
 /**/