Skip to content

Commit 6d0489a

Browse files
Michiel Jan Laurens de HoonMichiel Jan Laurens de Hoon
authored andcommitted
bpo-139145: fix spinning event loop in tkinter
1 parent 20d5494 commit 6d0489a

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

Modules/_tkinter.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3356,7 +3356,9 @@ static int stdin_ready = 0;
33563356
static void
33573357
MyFileProc(void *clientData, int mask)
33583358
{
3359+
int *tfile = clientData;
33593360
stdin_ready = 1;
3361+
Tcl_DeleteFileHandler(*tfile);
33603362
}
33613363
#endif
33623364

@@ -3373,7 +3375,7 @@ EventHook(void)
33733375
errorInCmd = 0;
33743376
#ifndef MS_WINDOWS
33753377
tfile = fileno(stdin);
3376-
Tcl_CreateFileHandler(tfile, TCL_READABLE, MyFileProc, NULL);
3378+
Tcl_CreateFileHandler(tfile, TCL_READABLE, MyFileProc, &tfile);
33773379
#endif
33783380
while (!errorInCmd && !stdin_ready) {
33793381
int result;
@@ -3398,9 +3400,6 @@ EventHook(void)
33983400
if (result < 0)
33993401
break;
34003402
}
3401-
#ifndef MS_WINDOWS
3402-
Tcl_DeleteFileHandler(tfile);
3403-
#endif
34043403
if (errorInCmd) {
34053404
errorInCmd = 0;
34063405
PyErr_SetRaisedException(excInCmd);

0 commit comments

Comments
 (0)