From: Serhiy Storchaka Date: Mon, 14 Jul 2014 09:20:01 +0000 (+0300) Subject: Call PyErr_NoMemory() when PyMem_Malloc() fails. X-Git-Tag: v2.7.9rc1~370 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=5d93f408d8ede65e3df7a35bcbf3cb2497d6ac5f;p=thirdparty%2FPython%2Fcpython.git Call PyErr_NoMemory() when PyMem_Malloc() fails. --- diff --git a/Modules/_tkinter.c b/Modules/_tkinter.c index 4aa8594e7651..8288c961b6d1 100644 --- a/Modules/_tkinter.c +++ b/Modules/_tkinter.c @@ -468,8 +468,10 @@ unicode_FromTclStringAndSize(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';