[Python-checkins] cpython (merge 3.2 -> default): merge 3.2

benjamin.peterson python-checkins at python.org
Tue Dec 20 20:33:17 CET 2011


http://hg.python.org/cpython/rev/ac29dc61873c
changeset:   74102:ac29dc61873c
parent:      74100:ba29dcb3403f
parent:      74101:40a211eb4fda
user:        Benjamin Peterson <benjamin at python.org>
date:        Tue Dec 20 13:32:50 2011 -0600
summary:
  merge 3.2

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


diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -12591,9 +12591,13 @@
         y_data = PyUnicode_DATA(y);
         for (i = 0; i < PyUnicode_GET_LENGTH(x); i++) {
             key = PyLong_FromLong(PyUnicode_READ(x_kind, x_data, i));
+            if (!key)
+                goto err;
             value = PyLong_FromLong(PyUnicode_READ(y_kind, y_data, i));
-            if (!key || !value)
+            if (!value) {
+                Py_DECREF(key);
                 goto err;
+            }
             res = PyDict_SetItem(new, key, value);
             Py_DECREF(key);
             Py_DECREF(value);

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


More information about the Python-checkins mailing list