mirror of https://github.com/python/cpython
convertsimple(): call PyErr_NoMemory() on PyMem_NEW() failure
Raise a more revelant error (MemoryError instead of TypeError)
This commit is contained in:
parent
5cb6239f00
commit
2872e5b1f8
|
@ -1172,6 +1172,7 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags,
|
|||
*buffer = PyMem_NEW(char, size + 1);
|
||||
if (*buffer == NULL) {
|
||||
Py_DECREF(s);
|
||||
PyErr_NoMemory();
|
||||
return converterr(
|
||||
"(memory error)",
|
||||
arg, msgbuf, bufsize);
|
||||
|
@ -1215,6 +1216,7 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags,
|
|||
*buffer = PyMem_NEW(char, size + 1);
|
||||
if (*buffer == NULL) {
|
||||
Py_DECREF(s);
|
||||
PyErr_NoMemory();
|
||||
return converterr("(memory error)",
|
||||
arg, msgbuf, bufsize);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue