diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2014-09-04 15:29:52 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2014-09-04 15:29:52 (GMT) |
commit | 60a64d6812e5d3c3bf4291081e3db9dc6acf996c (patch) | |
tree | 43585df316e1b22f6fa348da16b86172e74bc29e /Modules | |
parent | 53c87d1be2f2abd425c3999b43551ebe522a7460 (diff) | |
download | cpython-60a64d6812e5d3c3bf4291081e3db9dc6acf996c.zip cpython-60a64d6812e5d3c3bf4291081e3db9dc6acf996c.tar.gz cpython-60a64d6812e5d3c3bf4291081e3db9dc6acf996c.tar.bz2 |
Issue #21951: Fix AsObj() of the _tkinter module: raise MemoryError on memory
allocation failure
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/_tkinter.c | 6 |
1 files 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); |