From 2fdf4e7b9b30e2e7cae87a01334fca8e6b49eff2 Mon Sep 17 00:00:00 2001 From: Stefan Krah Date: Fri, 8 Nov 2013 18:05:02 +0100 Subject: [PATCH] Move PyErr_NoMemory() closer to the failure. --- Modules/_decimal/_decimal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/_decimal/_decimal.c b/Modules/_decimal/_decimal.c index aec3949c790..06c2c395b87 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] = '_';