summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2014-07-14 09:20:01 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2014-07-14 09:20:01 (GMT)
commit5d93f408d8ede65e3df7a35bcbf3cb2497d6ac5f (patch)
treeccc649f306e8594cae9c564858e1eac398afdb30
parent6e9a3ac88129854fcc3953f0d5594af2e73d71ea (diff)
downloadcpython-5d93f408d8ede65e3df7a35bcbf3cb2497d6ac5f.zip
cpython-5d93f408d8ede65e3df7a35bcbf3cb2497d6ac5f.tar.gz
cpython-5d93f408d8ede65e3df7a35bcbf3cb2497d6ac5f.tar.bz2
Call PyErr_NoMemory() when PyMem_Malloc() fails.
-rw-r--r--Modules/_tkinter.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/Modules/_tkinter.c b/Modules/_tkinter.c
index 4aa8594..8288c96 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';