Mercurial > vim
changeset 3883:b5b892472ecb v7.3.698
updated for version 7.3.698
Problem: Python 3 does not preserve state beween commands.
Solution: Preserve the state. (Paul Ollis)
author | Bram Moolenaar <bram@vim.org> |
---|---|
date | Sun, 21 Oct 2012 01:47:00 +0200 |
parents | 9db3c3ee277e |
children | 1418104f039a |
files | src/if_python.c src/if_python3.c src/version.c |
diffstat | 3 files changed, 11 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/src/if_python.c +++ b/src/if_python.c @@ -740,9 +740,10 @@ Python_Init(void) #else PyMac_Initialize(); #endif - /* Initialise threads and save the state using PyGILState_Ensure. - * Without this call, thread-specific state (such as the system trace - * hook), will be lost between invocations of Python code. */ + /* 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
--- 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();