From ca439eecea1f293d6954cc5cb562199480b74c17 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Sat, 16 Jun 2012 03:17:34 +0200 Subject: Fix unicode_adjust_maxchar(): catch PyUnicode_New() failure --- Objects/unicodeobject.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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; } -- cgit v0.12