Skip to content

Commit 9cb2e95

Browse files
committed
updated for version 7.3.698
Problem: Python 3 does not preserve state beween commands. Solution: Preserve the state. (Paul Ollis)
1 parent 1050735 commit 9cb2e95

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

src/if_python.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -740,9 +740,10 @@ Python_Init(void)
740740
#else
741741
PyMac_Initialize();
742742
#endif
743-
/* Initialise threads and save the state using PyGILState_Ensure.
744-
* Without this call, thread-specific state (such as the system trace
745-
* hook), will be lost between invocations of Python code. */
743+
/* Initialise threads, and save the state using PyGILState_Ensure.
744+
* Without the call to PyGILState_Ensure, thread specific state (such
745+
* as the system trace hook), will be lost between invocations of
746+
* Python code. */
746747
PyEval_InitThreads();
747748
pygilstate = PyGILState_Ensure();
748749
#ifdef DYNAMIC_PYTHON

src/if_python3.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -731,8 +731,12 @@ Python3_Init(void)
731731
#else
732732
PyMac_Initialize();
733733
#endif
734-
/* initialise threads, must be after Py_Initialize() */
734+
/* Initialise threads, and save the state using PyGILState_Ensure.
735+
* Without the call to PyGILState_Ensure, thread specific state (such
736+
* as the system trace hook), will be lost between invocations of
737+
* Python code. */
735738
PyEval_InitThreads();
739+
pygilstate = PyGILState_Ensure();
736740

737741
#ifdef DYNAMIC_PYTHON3
738742
get_py3_exceptions();

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -719,6 +719,8 @@ static char *(features[]) =
719719

720720
static int included_patches[] =
721721
{ /* Add new patch number below this line */
722+
/**/
723+
698,
722724
/**/
723725
697,
724726
/**/

0 commit comments

Comments
 (0)