[Python-checkins] cpython (3.3): Propagate error when PyByteArray_Resize() fails in bytearray_translate()

christian.heimes python-checkins at python.org
Sun Jul 21 02:04:53 CEST 2013


http://hg.python.org/cpython/rev/15ac20ee5b70
changeset:   84755:15ac20ee5b70
branch:      3.3
parent:      84753:a0bb8a1b71e0
user:        Christian Heimes <christian at cheimes.de>
date:        Sun Jul 21 02:04:35 2013 +0200
summary:
  Propagate error when PyByteArray_Resize() fails in bytearray_translate()
CID 715334

files:
  Objects/bytearrayobject.c |  5 ++++-
  1 files changed, 4 insertions(+), 1 deletions(-)


diff --git a/Objects/bytearrayobject.c b/Objects/bytearrayobject.c
--- a/Objects/bytearrayobject.c
+++ b/Objects/bytearrayobject.c
@@ -1506,7 +1506,10 @@
     }
     /* Fix the size of the resulting string */
     if (inlen > 0)
-        PyByteArray_Resize(result, output - output_start);
+        if (PyByteArray_Resize(result, output - output_start) < 0) {
+            Py_CLEAR(result);
+            goto done;
+        }
 
 done:
     if (tableobj != NULL)

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


More information about the Python-checkins mailing list