Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e9bc62d

Browse files
committed
RajGopal Srinivasan noted that the latest code doesn't work when
running in a non-threaded environment. He added some #ifdefs that fix this.
1 parent f05fc71 commit e9bc62d

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

Modules/_tkinter.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1902,7 +1902,9 @@ EventHook()
19021902
#ifndef MS_WINDOWS
19031903
FHANDLE tfile;
19041904
#endif
1905+
#ifdef WITH_THREAD
19051906
PyEval_RestoreThread(event_tstate);
1907+
#endif
19061908
stdin_ready = 0;
19071909
errorInCmd = 0;
19081910
#ifndef MS_WINDOWS
@@ -1945,7 +1947,9 @@ EventHook()
19451947
excInCmd = valInCmd = trbInCmd = NULL;
19461948
PyErr_Print();
19471949
}
1950+
#ifdef WITH_THREAD
19481951
PyEval_SaveThread();
1952+
#endif
19491953
return 0;
19501954
}
19511955

@@ -1956,7 +1960,9 @@ EnableEventHook()
19561960
{
19571961
#ifdef WAIT_FOR_STDIN
19581962
if (PyOS_InputHook == NULL) {
1963+
#ifdef WITH_THREAD
19591964
event_tstate = PyThreadState_Get();
1965+
#endif
19601966
PyOS_InputHook = EventHook;
19611967
}
19621968
#endif

0 commit comments

Comments
 (0)