[Python-checkins] cpython: Issue #18408: Fix fileio_read() on _PyBytes_Resize() failure

victor.stinner python-checkins at python.org
Tue Jul 16 23:09:15 CEST 2013


http://hg.python.org/cpython/rev/533eb9ab895a
changeset:   84669:533eb9ab895a
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Tue Jul 16 21:36:02 2013 +0200
summary:
  Issue #18408: Fix fileio_read() on _PyBytes_Resize() failure

bytes is NULL on _PyBytes_Resize() failure

files:
  Modules/_io/fileio.c |  2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)


diff --git a/Modules/_io/fileio.c b/Modules/_io/fileio.c
--- a/Modules/_io/fileio.c
+++ b/Modules/_io/fileio.c
@@ -739,7 +739,7 @@
 
     if (n != size) {
         if (_PyBytes_Resize(&bytes, n) < 0) {
-            Py_DECREF(bytes);
+            Py_CLEAR(bytes);
             return NULL;
         }
     }

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


More information about the Python-checkins mailing list