(Merge 3.1) Issue #11650: PyOS_StdioReadline() retries fgets() if it was
interrupted (EINTR), for example if the program is stopped with CTRL+z on Mac OS X. Patch written by Charles-Francois Natali.
This commit is contained in:
commit
a870e35a7d
|
@ -10,6 +10,10 @@ What's New in Python 3.2.1?
|
|||
Core and Builtins
|
||||
-----------------
|
||||
|
||||
- Issue #11650: PyOS_StdioReadline() retries fgets() if it was interrupted
|
||||
(EINTR), for example if the program is stopped with CTRL+z on Mac OS X. Patch
|
||||
written by Charles-Francois Natali.
|
||||
|
||||
- Issue #11395: io.FileIO().write() clamps the data length to 32,767 bytes on
|
||||
Windows if the file is a TTY to workaround a Windows bug. The Windows console
|
||||
returns an error (12: not enough space error) on writing into stdout if
|
||||
|
|
|
@ -36,6 +36,7 @@ static int
|
|||
my_fgets(char *buf, int len, FILE *fp)
|
||||
{
|
||||
char *p;
|
||||
while (1) {
|
||||
if (PyOS_InputHook != NULL)
|
||||
(void)(PyOS_InputHook)();
|
||||
errno = 0;
|
||||
|
@ -84,9 +85,10 @@ my_fgets(char *buf, int len, FILE *fp)
|
|||
#ifdef WITH_THREAD
|
||||
PyEval_SaveThread();
|
||||
#endif
|
||||
if (s < 0) {
|
||||
if (s < 0)
|
||||
return 1;
|
||||
}
|
||||
/* try again */
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
if (PyOS_InterruptOccurred()) {
|
||||
|
@ -94,6 +96,8 @@ my_fgets(char *buf, int len, FILE *fp)
|
|||
}
|
||||
return -2; /* Error */
|
||||
}
|
||||
/* NOTREACHED */
|
||||
}
|
||||
|
||||
|
||||
/* Readline implementation using fgets() */
|
||||
|
|
Loading…
Reference in New Issue