mirror of https://github.com/python/cpython
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:
parent
f866f97ca8
commit
34f7383d7a
|
@ -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] = '_';
|
||||||
|
|
Loading…
Reference in New Issue