[Python-checkins] cpython: Issue #18408: Fix PyUnicode_AsUTF8AndSize(), raise MemoryError exception on

victor.stinner python-checkins at python.org
Tue Oct 29 01:46:43 CET 2013


http://hg.python.org/cpython/rev/e1d51c42e5a1
changeset:   86716:e1d51c42e5a1
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Tue Oct 29 01:28:23 2013 +0100
summary:
  Issue #18408: Fix PyUnicode_AsUTF8AndSize(), raise MemoryError exception on
memory allocation failure

files:
  Objects/unicodeobject.c |  1 +
  1 files changed, 1 insertions(+), 0 deletions(-)


diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -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;
         }

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list