summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2010-06-06 20:38:02 (GMT)
committerVictor Stinner <victor.stinner@haypocalc.com>2010-06-06 20:38:02 (GMT)
commit2872e5b1f893c47acb0a194dbf92766ae1ff9e37 (patch)
tree59fcfbd2f88ae7327df20b5ee105836d229a5bc9
parent5cb6239f00e1d298be8e6198d945e05d9feaa9c7 (diff)
downloadcpython-2872e5b1f893c47acb0a194dbf92766ae1ff9e37.zip
cpython-2872e5b1f893c47acb0a194dbf92766ae1ff9e37.tar.gz
cpython-2872e5b1f893c47acb0a194dbf92766ae1ff9e37.tar.bz2
convertsimple(): call PyErr_NoMemory() on PyMem_NEW() failure
Raise a more revelant error (MemoryError instead of TypeError)
-rw-r--r--Python/getargs.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/Python/getargs.c b/Python/getargs.c
index 1806bf8..b4b5db2 100644
--- a/Python/getargs.c
+++ b/Python/getargs.c
@@ -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);
}