Commits

Victor Stinner committed 068f2bb

Fix unicode_adjust_maxchar(): catch PyUnicode_New() failure

Comments (0)

Files changed (1)

Objects/unicodeobject.c

             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;
 }