From: Victor Stinner Date: Mon, 30 May 2011 21:44:13 +0000 (+0200) Subject: Issue #12016: my_fgets() now always clears errors before calling fgets(). Fix X-Git-Tag: v2.7.3rc1~716 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=08563d904deac3b92418154b6116203adabdc61e;p=python 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. --- diff --git a/Misc/NEWS b/Misc/NEWS index 265d91e3e2..a8a1baf847 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -1,6 +1,22 @@ Python News +++++++++++ +What's New in Python 2.7.3? +=========================== + +*Release date: XXXX-XX-XX* + +Core and Builtins +----------------- + +- 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. + +Library +------- + + What's New in Python 2.7.2? =========================== diff --git a/Parser/myreadline.c b/Parser/myreadline.c index 34fb45c932..07c1d440e0 100644 --- a/Parser/myreadline.c +++ b/Parser/myreadline.c @@ -44,6 +44,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 */