]> granicus.if.org Git - python/commitdiff
Issue #19437: Fix dec_format() of the _decimal module, handle dec_strdup()
authorVictor Stinner <victor.stinner@gmail.com>
Tue, 29 Oct 2013 19:33:14 +0000 (20:33 +0100)
committerVictor Stinner <victor.stinner@gmail.com>
Tue, 29 Oct 2013 19:33:14 +0000 (20:33 +0100)
failure (memory allocation failure): raise a MemoryError exception

Modules/_decimal/_decimal.c

index 628b2f784f91b9f4bc35ddf4f0eca82a49c3f75b..6f9e9def4746c654cb6b5bc2e41e466bfe49937b 100644 (file)
@@ -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] = '_';