From: Victor Stinner Date: Tue, 29 Oct 2013 19:33:14 +0000 (+0100) Subject: Issue #19437: Fix dec_format() of the _decimal module, handle dec_strdup() X-Git-Tag: v3.4.0b1~334^2~3 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ac470854b8121ce4b5dc9388c9ad084f5359b2aa;p=thirdparty%2FPython%2Fcpython.git Issue #19437: Fix dec_format() of the _decimal module, handle dec_strdup() failure (memory allocation failure): raise a MemoryError exception --- diff --git a/Modules/_decimal/_decimal.c b/Modules/_decimal/_decimal.c index 628b2f784f91..6f9e9def4746 100644 --- a/Modules/_decimal/_decimal.c +++ b/Modules/_decimal/_decimal.c @@ -3187,6 +3187,7 @@ dec_format(PyObject *dec, PyObject *args) replace_fillchar = 1; fmt = dec_strdup(fmt, size); if (fmt == NULL) { + PyErr_NoMemory(); return NULL; } fmt[0] = '_';