Issue #19437: Fix dec_format() of the _decimal module, handle dec_strdup()

failure (memory allocation failure): raise a MemoryError exception
This commit is contained in:
Victor Stinner 2013-10-29 20:33:14 +01:00
parent f866f97ca8
commit 34f7383d7a
1 changed files with 1 additions and 0 deletions

View File

@ -3187,6 +3187,7 @@ dec_format(PyObject *dec, PyObject *args)
replace_fillchar = 1; replace_fillchar = 1;
fmt = dec_strdup(fmt, size); fmt = dec_strdup(fmt, size);
if (fmt == NULL) { if (fmt == NULL) {
PyErr_NoMemory();
return NULL; return NULL;
} }
fmt[0] = '_'; fmt[0] = '_';