summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2014-07-14 09:20:15 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2014-07-14 09:20:15 (GMT)
commitb1ebfdddb356d5ad63bacb10589a402c6407a86c (patch)
tree8f32f9c61476ebe29b4fb1b17f0bc8d21e136343
parent8323f68f3e50f73ce549d885c40bb17c06894376 (diff)
downloadcpython-b1ebfdddb356d5ad63bacb10589a402c6407a86c.zip
cpython-b1ebfdddb356d5ad63bacb10589a402c6407a86c.tar.gz
cpython-b1ebfdddb356d5ad63bacb10589a402c6407a86c.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 4a7b284..e3d3757 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';