From: Stefan Krah Date: Fri, 8 Nov 2013 17:05:02 +0000 (+0100) Subject: Move PyErr_NoMemory() closer to the failure. X-Git-Tag: v3.4.0b1~334^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=2fdf4e7b9b30e2e7cae87a01334fca8e6b49eff2;p=thirdparty%2FPython%2Fcpython.git Move PyErr_NoMemory() closer to the failure. --- diff --git a/Modules/_decimal/_decimal.c b/Modules/_decimal/_decimal.c index aec3949c7901..06c2c395b876 100644 --- a/Modules/_decimal/_decimal.c +++ b/Modules/_decimal/_decimal.c @@ -3108,6 +3108,7 @@ dec_strdup(const char *src, Py_ssize_t size) { char *dest = PyMem_Malloc(size+1); if (dest == NULL) { + PyErr_NoMemory(); return NULL; } @@ -3186,7 +3187,6 @@ dec_format(PyObject *dec, PyObject *args) replace_fillchar = 1; fmt = dec_strdup(fmt, size); if (fmt == NULL) { - PyErr_NoMemory(); return NULL; } fmt[0] = '_';