summaryrefslogtreecommitdiffstats
path: root/Parser
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2011-04-09 13:55:44 (GMT)
committerVictor Stinner <victor.stinner@haypocalc.com>2011-04-09 13:55:44 (GMT)
commit52c950f229199fa14bd75e1709183d0b08e90182 (patch)
tree214bcd32c43fc180d599fb4e0a686a0070cee208 /Parser
parente1292a25d8a063dcc97111cd2b0239dc1aef5aa2 (diff)
downloadcpython-52c950f229199fa14bd75e1709183d0b08e90182.zip
cpython-52c950f229199fa14bd75e1709183d0b08e90182.tar.gz
cpython-52c950f229199fa14bd75e1709183d0b08e90182.tar.bz2
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.
Diffstat (limited to 'Parser')
-rw-r--r--Parser/myreadline.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/Parser/myreadline.c b/Parser/myreadline.c
index a62e208..7166fc1 100644
--- a/Parser/myreadline.c
+++ b/Parser/myreadline.c
@@ -36,7 +36,7 @@ static int
my_fgets(char *buf, int len, FILE *fp)
{
char *p;
- for (;;) {
+ while (1) {
if (PyOS_InputHook != NULL)
(void)(PyOS_InputHook)();
errno = 0;
@@ -85,9 +85,10 @@ my_fgets(char *buf, int len, FILE *fp)
#ifdef WITH_THREAD
PyEval_SaveThread();
#endif
- if (s < 0) {
- return 1;
- }
+ if (s < 0)
+ return 1;
+ /* try again */
+ continue;
}
#endif
if (PyOS_InterruptOccurred()) {