[Python-checkins] cpython (2.7): Issue #12016: my_fgets() now always clears errors before calling fgets(). Fix

victor.stinner python-checkins at python.org
Mon May 30 23:47:15 CEST 2011


http://hg.python.org/cpython/rev/3b1b06570cf9
changeset:   70534:3b1b06570cf9
branch:      2.7
parent:      70509:439396b06416
user:        Victor Stinner <victor.stinner at haypocalc.com>
date:        Mon May 30 23:44:13 2011 +0200
summary:
  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.

files:
  Misc/NEWS           |  16 ++++++++++++++++
  Parser/myreadline.c |   1 +
  2 files changed, 17 insertions(+), 0 deletions(-)


diff --git a/Misc/NEWS b/Misc/NEWS
--- 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
--- a/Parser/myreadline.c
+++ b/Parser/myreadline.c
@@ -44,6 +44,7 @@
         if (PyOS_InputHook != NULL)
             (void)(PyOS_InputHook)();
         errno = 0;
+        clearerr(fp);
         p = fgets(buf, len, fp);
         if (p != NULL)
             return 0; /* No error */

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list