mirror of
https://github.com/python/cpython.git
synced 2025-08-30 21:48:47 +00:00
Fixed error message for the "u#" format code.
This commit is contained in:
parent
37de910b52
commit
d6e53dab86
1 changed files with 4 additions and 3 deletions
|
@ -968,7 +968,7 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags,
|
||||||
Py_UNICODE **p = va_arg(*p_va, Py_UNICODE **);
|
Py_UNICODE **p = va_arg(*p_va, Py_UNICODE **);
|
||||||
|
|
||||||
if (*format == '#') {
|
if (*format == '#') {
|
||||||
/* "s#" or "Z#" */
|
/* "u#" or "Z#" */
|
||||||
FETCH_SIZE;
|
FETCH_SIZE;
|
||||||
|
|
||||||
if (c == 'Z' && arg == Py_None) {
|
if (c == 'Z' && arg == Py_None) {
|
||||||
|
@ -983,10 +983,11 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags,
|
||||||
STORE_SIZE(len);
|
STORE_SIZE(len);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return converterr("str or None", arg, msgbuf, bufsize);
|
return converterr(c == 'Z' ? "str or None" : "str",
|
||||||
|
arg, msgbuf, bufsize);
|
||||||
format++;
|
format++;
|
||||||
} else {
|
} else {
|
||||||
/* "s" or "Z" */
|
/* "u" or "Z" */
|
||||||
if (c == 'Z' && arg == Py_None)
|
if (c == 'Z' && arg == Py_None)
|
||||||
*p = NULL;
|
*p = NULL;
|
||||||
else if (PyUnicode_Check(arg)) {
|
else if (PyUnicode_Check(arg)) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue