From 60a64d6812e5d3c3bf4291081e3db9dc6acf996c Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Thu, 4 Sep 2014 17:29:52 +0200 Subject: Issue #21951: Fix AsObj() of the _tkinter module: raise MemoryError on memory allocation failure --- Modules/_tkinter.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Modules/_tkinter.c b/Modules/_tkinter.c index 0717594..4df45ad 100644 --- a/Modules/_tkinter.c +++ b/Modules/_tkinter.c @@ -913,8 +913,10 @@ AsObj(PyObject *value) 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); -- cgit v0.12