]> granicus.if.org Git - python/commitdiff
Issue #12016: my_fgets() now always clears errors before calling fgets(). Fix
authorVictor Stinner <victor.stinner@haypocalc.com>
Mon, 30 May 2011 21:44:13 +0000 (23:44 +0200)
committerVictor Stinner <victor.stinner@haypocalc.com>
Mon, 30 May 2011 21:44:13 +0000 (23:44 +0200)
the following case: sys.stdin.read() stopped with CTRL+d (end of file),
raw_input() interrupted by CTRL+c.

Misc/NEWS
Parser/myreadline.c

index 265d91e3e25f1cdb1c3250a3740ccd89ed99ed6f..a8a1baf847dfb58eb6a1e0dd4f1aa6e2a7214382 100644 (file)
--- 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?
 ===========================
 
index 34fb45c93243d6b72342ba9da57c76e530140e6c..07c1d440e0717f60cc9a9557923b600b8f2d6aba 100644 (file)
@@ -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 */