[Python-checkins] cpython: Issue #21951: Fix AsObj() of the _tkinter module: raise MemoryError on memory

victor.stinner python-checkins at python.org
Thu Sep 4 17:30:34 CEST 2014


http://hg.python.org/cpython/rev/9ab404cdcaa1
changeset:   92334:9ab404cdcaa1
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Thu Sep 04 17:29:52 2014 +0200
summary:
  Issue #21951: Fix AsObj() of the _tkinter module: raise MemoryError on memory
allocation failure

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


diff --git a/Modules/_tkinter.c b/Modules/_tkinter.c
--- a/Modules/_tkinter.c
+++ b/Modules/_tkinter.c
@@ -913,8 +913,10 @@
             return NULL;
         }
         argv = (Tcl_Obj **) ckalloc(((size_t)size) * sizeof(Tcl_Obj *));
-        if(!argv)
-          return 0;
+        if(!argv) {
+          PyErr_NoMemory();
+          return NULL;
+        }
         for (i = 0; i < size; i++)
           argv[i] = AsObj(PySequence_Fast_GET_ITEM(value,i));
         result = Tcl_NewListObj(size, argv);

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


More information about the Python-checkins mailing list