From: Serhiy Storchaka Date: Mon, 14 Jul 2014 09:20:15 +0000 (+0300) Subject: Call PyErr_NoMemory() when PyMem_Malloc() fails. X-Git-Tag: v3.4.2rc1~226 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b1ebfdddb356d5ad63bacb10589a402c6407a86c;p=python Call PyErr_NoMemory() when PyMem_Malloc() fails. --- diff --git a/Modules/_tkinter.c b/Modules/_tkinter.c index 4a7b284b26..e3d3757bb6 100644 --- a/Modules/_tkinter.c +++ b/Modules/_tkinter.c @@ -339,8 +339,10 @@ unicodeFromTclStringAndSize(const char *s, Py_ssize_t size) const char *e = s + size; PyErr_Clear(); q = buf = (char *)PyMem_Malloc(size); - if (buf == NULL) + if (buf == NULL) { + PyErr_NoMemory(); return NULL; + } while (s != e) { if (s + 1 != e && s[0] == '\xc0' && s[1] == '\x80') { *q++ = '\0';