]> granicus.if.org Git - python/commitdiff
Fixed error message for the "u#" format code.
authorSerhiy Storchaka <storchaka@gmail.com>
Sun, 19 Apr 2015 18:11:30 +0000 (21:11 +0300)
committerSerhiy Storchaka <storchaka@gmail.com>
Sun, 19 Apr 2015 18:11:30 +0000 (21:11 +0300)
Python/getargs.c

index 3f47b21da5e119c4d579a1a1c5f85d41d182be77..6902d134892ba92971da55c1c4ad966db451dd46 100644 (file)
@@ -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 **);
 
         if (*format == '#') {
-            /* "s#" or "Z#" */
+            /* "u#" or "Z#" */
             FETCH_SIZE;
 
             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);
             }
             else
-                return converterr("str or None", arg, msgbuf, bufsize);
+                return converterr(c == 'Z' ? "str or None" : "str",
+                                  arg, msgbuf, bufsize);
             format++;
         } else {
-            /* "s" or "Z" */
+            /* "u" or "Z" */
             if (c == 'Z' && arg == Py_None)
                 *p = NULL;
             else if (PyUnicode_Check(arg)) {