summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2012-06-16 01:17:34 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2012-06-16 01:17:34 (GMT)
commitca439eecea1f293d6954cc5cb562199480b74c17 (patch)
treed6f3cbb6e87efcbb34f7f48e98243be414cc2cd3 /Objects
parent184252ad3f66fe829aca03386d9ade38ce5aa4c4 (diff)
downloadcpython-ca439eecea1f293d6954cc5cb562199480b74c17.zip
cpython-ca439eecea1f293d6954cc5cb562199480b74c17.tar.gz
cpython-ca439eecea1f293d6954cc5cb562199480b74c17.tar.bz2
Fix unicode_adjust_maxchar(): catch PyUnicode_New() failure
Diffstat (limited to 'Objects')
-rw-r--r--Objects/unicodeobject.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index d1f2a35..ad0e2e3 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -2084,7 +2084,8 @@ unicode_adjust_maxchar(PyObject **p_unicode)
return;
}
copy = PyUnicode_New(len, max_char);
- _PyUnicode_FastCopyCharacters(copy, 0, unicode, 0, len);
+ if (copy != NULL)
+ _PyUnicode_FastCopyCharacters(copy, 0, unicode, 0, len);
Py_DECREF(unicode);
*p_unicode = copy;
}