summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2011-12-20 19:32:50 (GMT)
committerBenjamin Peterson <benjamin@python.org>2011-12-20 19:32:50 (GMT)
commit822c790527eb4601e7303199ad78be4c9eb9bb72 (patch)
treea5cf05c865324835f1945f0e4c114344ea4e899f
parent97193c1a1600141107e78c851058098404c73d62 (diff)
parent53aa1d7c5756eda92bd3276dd38dfa1f0c4bcee2 (diff)
downloadcpython-822c790527eb4601e7303199ad78be4c9eb9bb72.zip
cpython-822c790527eb4601e7303199ad78be4c9eb9bb72.tar.gz
cpython-822c790527eb4601e7303199ad78be4c9eb9bb72.tar.bz2
merge 3.2
-rw-r--r--Objects/unicodeobject.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index 1eb24dd..fd9175d 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -12591,9 +12591,13 @@ unicode_maketrans(PyObject *null, PyObject *args)
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);