summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2013-10-29 00:28:23 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2013-10-29 00:28:23 (GMT)
commita5afb58986cc0cd63908f1b5b44d472611f67b4f (patch)
tree21e9c77e1118715842098cac10be3b553872e829 /Objects
parent41bb43a71e1caa4e6993c6571544d415c9e178b9 (diff)
downloadcpython-a5afb58986cc0cd63908f1b5b44d472611f67b4f.zip
cpython-a5afb58986cc0cd63908f1b5b44d472611f67b4f.tar.gz
cpython-a5afb58986cc0cd63908f1b5b44d472611f67b4f.tar.bz2
Issue #18408: Fix PyUnicode_AsUTF8AndSize(), raise MemoryError exception on
memory allocation failure
Diffstat (limited to 'Objects')
-rw-r--r--Objects/unicodeobject.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index ff806cf..87c6472 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -3766,6 +3766,7 @@ PyUnicode_AsUTF8AndSize(PyObject *unicode, Py_ssize_t *psize)
return NULL;
_PyUnicode_UTF8(unicode) = PyObject_MALLOC(PyBytes_GET_SIZE(bytes) + 1);
if (_PyUnicode_UTF8(unicode) == NULL) {
+ PyErr_NoMemory();
Py_DECREF(bytes);
return NULL;
}