From: Victor Stinner Date: Sat, 16 Jun 2012 01:17:34 +0000 (+0200) Subject: Fix unicode_adjust_maxchar(): catch PyUnicode_New() failure X-Git-Tag: v3.3.0b1~228 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ca439eecea1f293d6954cc5cb562199480b74c17;p=python Fix unicode_adjust_maxchar(): catch PyUnicode_New() failure --- diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index d1f2a35051..ad0e2e3843 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; }