[Python-checkins] cpython (merge 3.4 -> default): Call PyErr_NoMemory() when PyMem_Malloc() fails.

serhiy.storchaka python-checkins at python.org
Mon Jul 14 11:21:32 CEST 2014


http://hg.python.org/cpython/rev/bdf04552f4df
changeset:   91676:bdf04552f4df
parent:      91673:b66f81069bc3
parent:      91675:b57b4e3b83ff
user:        Serhiy Storchaka <storchaka at gmail.com>
date:        Mon Jul 14 12:20:49 2014 +0300
summary:
  Call PyErr_NoMemory() when PyMem_Malloc() fails.

files:
  Modules/_tkinter.c |  4 +++-
  1 files changed, 3 insertions(+), 1 deletions(-)


diff --git a/Modules/_tkinter.c b/Modules/_tkinter.c
--- a/Modules/_tkinter.c
+++ b/Modules/_tkinter.c
@@ -339,8 +339,10 @@
             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';

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list