summaryrefslogtreecommitdiff
path: root/Parser/myreadline.c
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2011-05-30 23:46:00 +0200
committerVictor Stinner <victor.stinner@haypocalc.com>2011-05-30 23:46:00 +0200
commit4f71101eeda6fb0b55805ebcb12d11124ab3b567 (patch)
tree67e214541a944009850bc0997a507be17a20ed6a /Parser/myreadline.c
parent76450a96efb6ea60187c358edef218ef71a18ed9 (diff)
downloadcpython-git-4f71101eeda6fb0b55805ebcb12d11124ab3b567.tar.gz
Issue #12016: my_fgets() now always clears errors before calling fgets(). Fix
the following case: sys.stdin.read() stopped with CTRL+d (end of file), raw_input() interrupted by CTRL+c.
Diffstat (limited to 'Parser/myreadline.c')
-rw-r--r--Parser/myreadline.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/Parser/myreadline.c b/Parser/myreadline.c
index b12d0525b1..fb4b805e20 100644
--- a/Parser/myreadline.c
+++ b/Parser/myreadline.c
@@ -40,6 +40,7 @@ my_fgets(char *buf, int len, FILE *fp)
if (PyOS_InputHook != NULL)
(void)(PyOS_InputHook)();
errno = 0;
+ clearerr(fp);
p = fgets(buf, len, fp);
if (p != NULL)
return 0; /* No error */