summaryrefslogtreecommitdiff
path: root/Python/getargs.c
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2010-06-08 21:45:51 +0000
committerVictor Stinner <victor.stinner@haypocalc.com>2010-06-08 21:45:51 +0000
commitb6a0126b4eabe96869ef204f02261402bd02365b (patch)
treeb01898cba9774300ab5e4ad31c7fba94445050dc /Python/getargs.c
parentbb4e6d2cdb19b9ad4d8439844127032223299b8f (diff)
downloadcpython-b6a0126b4eabe96869ef204f02261402bd02365b.tar.gz
PyArg_Parse*("Z#") raises an error for unknown type
instead of ignoring the error and leave the pointer to the string and the size unchanged (not initialized). Fix also the type in the error message of "Z", "Z#" and "Y" formats.
Diffstat (limited to 'Python/getargs.c')
-rw-r--r--Python/getargs.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/Python/getargs.c b/Python/getargs.c
index b4b5db283c..31b9d35716 100644
--- a/Python/getargs.c
+++ b/Python/getargs.c
@@ -1051,6 +1051,8 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags,
*p = PyUnicode_AS_UNICODE(arg);
STORE_SIZE(PyUnicode_GET_SIZE(arg));
}
+ else
+ return converterr("str or None", arg, msgbuf, bufsize);
format++;
} else {
Py_UNICODE **p = va_arg(*p_va, Py_UNICODE **);
@@ -1060,8 +1062,7 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags,
else if (PyUnicode_Check(arg))
*p = PyUnicode_AS_UNICODE(arg);
else
- return converterr("string or None",
- arg, msgbuf, bufsize);
+ return converterr("str or None", arg, msgbuf, bufsize);
}
break;
}
@@ -1258,7 +1259,7 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags,
if (PyByteArray_Check(arg))
*p = arg;
else
- return converterr("buffer", arg, msgbuf, bufsize);
+ return converterr("bytearray", arg, msgbuf, bufsize);
break;
}