Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d6e53da

Browse files
Fixed error message for the "u#" format code.
1 parent 37de910 commit d6e53da

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

Python/getargs.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -968,7 +968,7 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags,
968968
Py_UNICODE **p = va_arg(*p_va, Py_UNICODE **);
969969

970970
if (*format == '#') {
971-
/* "s#" or "Z#" */
971+
/* "u#" or "Z#" */
972972
FETCH_SIZE;
973973

974974
if (c == 'Z' && arg == Py_None) {
@@ -983,10 +983,11 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags,
983983
STORE_SIZE(len);
984984
}
985985
else
986-
return converterr("str or None", arg, msgbuf, bufsize);
986+
return converterr(c == 'Z' ? "str or None" : "str",
987+
arg, msgbuf, bufsize);
987988
format++;
988989
} else {
989-
/* "s" or "Z" */
990+
/* "u" or "Z" */
990991
if (c == 'Z' && arg == Py_None)
991992
*p = NULL;
992993
else if (PyUnicode_Check(arg)) {

0 commit comments

Comments
 (0)