Index: myreadline.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Parser/myreadline.c,v retrieving revision 2.34 diff -c -r2.34 myreadline.c *** myreadline.c 7 Apr 2005 10:11:18 -0000 2.34 --- myreadline.c 13 May 2005 03:38:46 -0000 *************** *** 13,18 **** --- 13,19 ---- #ifdef MS_WINDOWS #define WIN32_LEAN_AND_MEAN #include "windows.h" + #include "conio.h" #endif /* MS_WINDOWS */ #ifdef __VMS *************** *** 41,52 **** { char *p; for (;;) { ! if (PyOS_InputHook != NULL) ! (void)(PyOS_InputHook)(); errno = 0; ! p = fgets(buf, len, fp); ! if (p != NULL) ! return 0; /* No error */ #ifdef MS_WINDOWS /* In the case of a Ctrl+C or some other external event interrupting the operation: --- 42,86 ---- { char *p; for (;;) { ! int has_input = 0; ! #ifdef MS_WINDOWS ! HANDLE hStdIn = GetStdHandle(STD_INPUT_HANDLE); errno = 0; ! ! while (!has_input) { ! DWORD timeout = 100; /* 100 milliseconds */ ! DWORD result; ! if (PyOS_InputHook) PyOS_InputHook(); ! result = WaitForSingleObject(hStdIn, timeout); ! if (result==WAIT_OBJECT_0) { ! /* Check if this was a keyboard event, ! * not a mouse event */ ! if (_kbhit()) has_input = 1; ! } ! } ! #else ! fd_set selectset; ! errno = 0; ! ! FD_ZERO(&selectset); ! ! while (!has_input) { ! struct timeval timeout = {0, 100000}; ! /* 100000 microseconds */ ! FD_SET(fileno(fp), &selectset); ! if (PyOS_InputHook) PyOS_InputHook(); ! /* select resets selectset if no input was available */ ! has_input = select(fileno(fp) + 1, &selectset, ! NULL, NULL, &timeout); ! } ! #endif ! ! if (has_input > 0) { ! p = fgets(buf, len, fp); ! if (p != NULL) ! return 0; /* No error */ ! } ! #ifdef MS_WINDOWS /* In the case of a Ctrl+C or some other external event interrupting the operation: