changeset: 86716:e1d51c42e5a1 user: Victor Stinner date: Tue Oct 29 01:28:23 2013 +0100 files: Objects/unicodeobject.c description: Issue #18408: Fix PyUnicode_AsUTF8AndSize(), raise MemoryError exception on memory allocation failure diff -r 4ef4578db38a -r e1d51c42e5a1 Objects/unicodeobject.c --- a/Objects/unicodeobject.c Tue Oct 29 01:19:37 2013 +0100 +++ b/Objects/unicodeobject.c Tue Oct 29 01:28:23 2013 +0100 @@ -3766,6 +3766,7 @@ return NULL; _PyUnicode_UTF8(unicode) = PyObject_MALLOC(PyBytes_GET_SIZE(bytes) + 1); if (_PyUnicode_UTF8(unicode) == NULL) { + PyErr_NoMemory(); Py_DECREF(bytes); return NULL; }