To: vim_dev@googlegroups.com
Subject: Patch 7.3.698
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------

Patch 7.3.698
Problem:    Python 3 does not preserve state beween commands.
Solution:   Preserve the state. (Paul Ollis)
Files:      src/if_python.c, src/if_python3.c


*** ../vim-7.3.697/src/if_python.c	2012-10-14 05:20:05.000000000 +0200
--- src/if_python.c	2012-10-21 01:44:10.000000000 +0200
***************
*** 740,748 ****
  #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.  */
  	PyEval_InitThreads();
  	pygilstate = PyGILState_Ensure();
  #ifdef DYNAMIC_PYTHON
--- 740,749 ----
  #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. */
  	PyEval_InitThreads();
  	pygilstate = PyGILState_Ensure();
  #ifdef DYNAMIC_PYTHON
*** ../vim-7.3.697/src/if_python3.c	2012-10-14 03:22:49.000000000 +0200
--- src/if_python3.c	2012-10-21 01:44:37.000000000 +0200
***************
*** 731,738 ****
  #else
  	PyMac_Initialize();
  #endif
! 	/* initialise threads, must be after Py_Initialize() */
  	PyEval_InitThreads();
  
  #ifdef DYNAMIC_PYTHON3
  	get_py3_exceptions();
--- 731,742 ----
  #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. */
  	PyEval_InitThreads();
+ 	pygilstate = PyGILState_Ensure();
  
  #ifdef DYNAMIC_PYTHON3
  	get_py3_exceptions();
*** ../vim-7.3.697/src/version.c	2012-10-21 01:40:24.000000000 +0200
--- src/version.c	2012-10-21 01:42:44.000000000 +0200
***************
*** 721,722 ****
--- 721,724 ----
  {   /* Add new patch number below this line */
+ /**/
+     698,
  /**/

-- 
ALL:   A witch!  A witch!
WITCH: It's a fair cop.
ALL:   Burn her!  Burn her!  Let's make her into a ladder.
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///
