[Python-checkins] cpython (merge 3.4 -> default): (Merge 3.4) Issue #21090: io.FileIO.readall() does not ignore I/O errors

victor.stinner python-checkins at python.org
Wed Jul 2 23:01:36 CEST 2014


http://hg.python.org/cpython/rev/440279cec378
changeset:   91526:440279cec378
parent:      91524:3744b6ad8c3f
parent:      91525:652b62213072
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Wed Jul 02 23:00:38 2014 +0200
summary:
  (Merge 3.4) Issue #21090: io.FileIO.readall() does not ignore I/O errors
anymore. Before, it ignored I/O errors if at least the first C call read()
succeed.

files:
  Misc/NEWS            |  3 +++
  Modules/_io/fileio.c |  4 ++--
  2 files changed, 5 insertions(+), 2 deletions(-)


diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -103,6 +103,9 @@
 Library
 -------
 
+- Issue #21090: io.FileIO.readall() does not ignore I/O errors anymore. Before,
+  it ignored I/O errors if at least the first C call read() succeed.
+
 - Issue #5800: headers parameter of wsgiref.headers.Headers is now optional.
   Initial patch by Pablo Torres Navarrete and SilentGhost.
 
diff --git a/Modules/_io/fileio.c b/Modules/_io/fileio.c
--- a/Modules/_io/fileio.c
+++ b/Modules/_io/fileio.c
@@ -694,9 +694,9 @@
                 }
                 continue;
             }
-            if (bytes_read > 0)
-                break;
             if (errno == EAGAIN) {
+                if (bytes_read > 0)
+                    break;
                 Py_DECREF(result);
                 Py_RETURN_NONE;
             }

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


More information about the Python-checkins mailing list