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

Skip to content

Commit db46fea

Browse files
Fixed error message for the "u#" format code.
2 parents bb72c47 + d6e53da commit db46fea

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
@@ -967,7 +967,7 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags,
967967
Py_UNICODE **p = va_arg(*p_va, Py_UNICODE **);
968968

969969
if (*format == '#') {
970-
/* "s#" or "Z#" */
970+
/* "u#" or "Z#" */
971971
FETCH_SIZE;
972972

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

0 commit comments

Comments
 (0)