summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2013-10-29 19:33:14 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2013-10-29 19:33:14 (GMT)
commit34f7383d7ae1d3d040b3978680b9498c4ed150f5 (patch)
treed48fd21d8f9093793b7bb2b8b8fc42d42a14136d
parentf866f97ca8fed17cb10c0fd06b65b75b33843ff9 (diff)
downloadcpython-34f7383d7ae1d3d040b3978680b9498c4ed150f5.zip
cpython-34f7383d7ae1d3d040b3978680b9498c4ed150f5.tar.gz
cpython-34f7383d7ae1d3d040b3978680b9498c4ed150f5.tar.bz2
Issue #19437: Fix dec_format() of the _decimal module, handle dec_strdup()
failure (memory allocation failure): raise a MemoryError exception
-rw-r--r--Modules/_decimal/_decimal.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/Modules/_decimal/_decimal.c b/Modules/_decimal/_decimal.c
index 628b2f7..6f9e9de 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] = '_';