Commit 52c950f2 authored by Victor Stinner's avatar Victor Stinner

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.
parent e1292a25
...@@ -10,6 +10,10 @@ What's New in Python 3.1.4? ...@@ -10,6 +10,10 @@ What's New in Python 3.1.4?
Core and Builtins 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 #8651: PyArg_Parse*() functions raise an OverflowError if the file - Issue #8651: PyArg_Parse*() functions raise an OverflowError if the file
doesn't have PY_SSIZE_T_CLEAN define and the size doesn't fit in an int doesn't have PY_SSIZE_T_CLEAN define and the size doesn't fit in an int
(length bigger than 2^31-1 bytes). (length bigger than 2^31-1 bytes).
......
...@@ -36,7 +36,7 @@ static int ...@@ -36,7 +36,7 @@ static int
my_fgets(char *buf, int len, FILE *fp) my_fgets(char *buf, int len, FILE *fp)
{ {
char *p; char *p;
for (;;) { while (1) {
if (PyOS_InputHook != NULL) if (PyOS_InputHook != NULL)
(void)(PyOS_InputHook)(); (void)(PyOS_InputHook)();
errno = 0; errno = 0;
...@@ -85,9 +85,10 @@ my_fgets(char *buf, int len, FILE *fp) ...@@ -85,9 +85,10 @@ my_fgets(char *buf, int len, FILE *fp)
#ifdef WITH_THREAD #ifdef WITH_THREAD
PyEval_SaveThread(); PyEval_SaveThread();
#endif #endif
if (s < 0) { if (s < 0)
return 1; return 1;
} /* try again */
continue;
} }
#endif #endif
if (PyOS_InterruptOccurred()) { if (PyOS_InterruptOccurred()) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment