diff options
author | Bram Moolenaar <Bram@vim.org> | 2013-01-30 11:44:39 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2013-01-30 11:44:39 +0100 |
commit | 02366255c9bd16120c5025106f7ac5d5a06774d7 (patch) | |
tree | 0f2da4133e8b3544143630621bf1fc84d387a735 | |
parent | 2f315ab7bec2713d2fb986c5d863f15ab9949166 (diff) | |
download | vim-git-02366255c9bd16120c5025106f7ac5d5a06774d7.tar.gz |
updated for version 7.3.786v7.3.786
Problem: Python threads don't run in the background (issue 103).
Solution: Move the statements to manipulate thread state.
-rw-r--r-- | src/if_python.c | 16 | ||||
-rw-r--r-- | src/version.c | 2 |
2 files changed, 11 insertions, 7 deletions
diff --git a/src/if_python.c b/src/if_python.c index 5e792b16d..1bf737fc4 100644 --- a/src/if_python.c +++ b/src/if_python.c @@ -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; } diff --git a/src/version.c b/src/version.c index 0f77ad255..8115020bf 100644 --- a/src/version.c +++ b/src/version.c @@ -726,6 +726,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 786, +/**/ 785, /**/ 784, |