|
Karsten Hopp |
402e05 |
To: vim_dev@googlegroups.com
|
|
Karsten Hopp |
402e05 |
Subject: Patch 7.3.786
|
|
Karsten Hopp |
402e05 |
Fcc: outbox
|
|
Karsten Hopp |
402e05 |
From: Bram Moolenaar <Bram@moolenaar.net>
|
|
Karsten Hopp |
402e05 |
Mime-Version: 1.0
|
|
Karsten Hopp |
402e05 |
Content-Type: text/plain; charset=UTF-8
|
|
Karsten Hopp |
402e05 |
Content-Transfer-Encoding: 8bit
|
|
Karsten Hopp |
402e05 |
------------
|
|
Karsten Hopp |
402e05 |
|
|
Karsten Hopp |
402e05 |
Patch 7.3.786
|
|
Karsten Hopp |
402e05 |
Problem: Python threads don't run in the background (issue 103).
|
|
Karsten Hopp |
402e05 |
Solution: Move the statements to manipulate thread state.
|
|
Karsten Hopp |
402e05 |
Files: src/if_python.c
|
|
Karsten Hopp |
402e05 |
|
|
Karsten Hopp |
402e05 |
|
|
Karsten Hopp |
402e05 |
*** ../vim-7.3.785/src/if_python.c 2012-10-21 01:46:56.000000000 +0200
|
|
Karsten Hopp |
402e05 |
--- src/if_python.c 2013-01-30 11:38:06.000000000 +0100
|
|
Karsten Hopp |
402e05 |
***************
|
|
Karsten Hopp |
402e05 |
*** 740,751 ****
|
|
Karsten Hopp |
402e05 |
#else
|
|
Karsten Hopp |
402e05 |
PyMac_Initialize();
|
|
Karsten Hopp |
402e05 |
#endif
|
|
Karsten Hopp |
402e05 |
! /* Initialise threads, and save the state using PyGILState_Ensure.
|
|
Karsten Hopp |
402e05 |
! * Without the call to PyGILState_Ensure, thread specific state (such
|
|
Karsten Hopp |
402e05 |
! * as the system trace hook), will be lost between invocations of
|
|
Karsten Hopp |
402e05 |
! * Python code. */
|
|
Karsten Hopp |
402e05 |
PyEval_InitThreads();
|
|
Karsten Hopp |
402e05 |
- pygilstate = PyGILState_Ensure();
|
|
Karsten Hopp |
402e05 |
#ifdef DYNAMIC_PYTHON
|
|
Karsten Hopp |
402e05 |
get_exceptions();
|
|
Karsten Hopp |
402e05 |
#endif
|
|
Karsten Hopp |
402e05 |
--- 740,750 ----
|
|
Karsten Hopp |
402e05 |
#else
|
|
Karsten Hopp |
402e05 |
PyMac_Initialize();
|
|
Karsten Hopp |
402e05 |
#endif
|
|
Karsten Hopp |
402e05 |
! /* Initialise threads, and below save the state using
|
|
Karsten Hopp |
402e05 |
! * PyGILState_Ensure. Without the call to PyGILState_Ensure, thread
|
|
Karsten Hopp |
402e05 |
! * specific state (such as the system trace hook), will be lost
|
|
Karsten Hopp |
402e05 |
! * between invocations of Python code. */
|
|
Karsten Hopp |
402e05 |
PyEval_InitThreads();
|
|
Karsten Hopp |
402e05 |
#ifdef DYNAMIC_PYTHON
|
|
Karsten Hopp |
402e05 |
get_exceptions();
|
|
Karsten Hopp |
402e05 |
#endif
|
|
Karsten Hopp |
402e05 |
***************
|
|
Karsten Hopp |
402e05 |
*** 756,761 ****
|
|
Karsten Hopp |
402e05 |
--- 755,764 ----
|
|
Karsten Hopp |
402e05 |
if (PythonMod_Init())
|
|
Karsten Hopp |
402e05 |
goto fail;
|
|
Karsten Hopp |
402e05 |
|
|
Karsten Hopp |
402e05 |
+ /* The first python thread is vim's, release the lock. */
|
|
Karsten Hopp |
402e05 |
+ Python_SaveThread();
|
|
Karsten Hopp |
402e05 |
+ pygilstate = PyGILState_Ensure();
|
|
Karsten Hopp |
402e05 |
+
|
|
Karsten Hopp |
402e05 |
globals = PyModule_GetDict(PyImport_AddModule("__main__"));
|
|
Karsten Hopp |
402e05 |
|
|
Karsten Hopp |
402e05 |
/* Remove the element from sys.path that was added because of our
|
|
Karsten Hopp |
402e05 |
***************
|
|
Karsten Hopp |
402e05 |
*** 764,771 ****
|
|
Karsten Hopp |
402e05 |
* the current directory in sys.path. */
|
|
Karsten Hopp |
402e05 |
PyRun_SimpleString("import sys; sys.path = filter(lambda x: x != '/must>not&exist', sys.path)");
|
|
Karsten Hopp |
402e05 |
|
|
Karsten Hopp |
402e05 |
! /* the first python thread is vim's, release the lock */
|
|
Karsten Hopp |
402e05 |
! Python_SaveThread();
|
|
Karsten Hopp |
402e05 |
|
|
Karsten Hopp |
402e05 |
initialised = 1;
|
|
Karsten Hopp |
402e05 |
}
|
|
Karsten Hopp |
402e05 |
--- 767,773 ----
|
|
Karsten Hopp |
402e05 |
* the current directory in sys.path. */
|
|
Karsten Hopp |
402e05 |
PyRun_SimpleString("import sys; sys.path = filter(lambda x: x != '/must>not&exist', sys.path)");
|
|
Karsten Hopp |
402e05 |
|
|
Karsten Hopp |
402e05 |
! PyGILState_Release(pygilstate);
|
|
Karsten Hopp |
402e05 |
|
|
Karsten Hopp |
402e05 |
initialised = 1;
|
|
Karsten Hopp |
402e05 |
}
|
|
Karsten Hopp |
402e05 |
*** ../vim-7.3.785/src/version.c 2013-01-25 20:10:58.000000000 +0100
|
|
Karsten Hopp |
402e05 |
--- src/version.c 2013-01-30 11:44:04.000000000 +0100
|
|
Karsten Hopp |
402e05 |
***************
|
|
Karsten Hopp |
402e05 |
*** 727,728 ****
|
|
Karsten Hopp |
402e05 |
--- 727,730 ----
|
|
Karsten Hopp |
402e05 |
{ /* Add new patch number below this line */
|
|
Karsten Hopp |
402e05 |
+ /**/
|
|
Karsten Hopp |
402e05 |
+ 786,
|
|
Karsten Hopp |
402e05 |
/**/
|
|
Karsten Hopp |
402e05 |
|
|
Karsten Hopp |
402e05 |
--
|
|
Karsten Hopp |
402e05 |
ARTHUR: I command you as King of the Britons to stand aside!
|
|
Karsten Hopp |
402e05 |
BLACK KNIGHT: I move for no man.
|
|
Karsten Hopp |
402e05 |
The Quest for the Holy Grail (Monty Python)
|
|
Karsten Hopp |
402e05 |
|
|
Karsten Hopp |
402e05 |
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
|
|
Karsten Hopp |
402e05 |
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
|
|
Karsten Hopp |
402e05 |
\\\ an exciting new programming language -- http://www.Zimbu.org ///
|
|
Karsten Hopp |
402e05 |
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
|