[Python-checkins] cpython (merge 3.4 -> default): Fixed error message for the "u#" format code.

serhiy.storchaka python-checkins at python.org
Sun Apr 19 20:13:27 CEST 2015


https://hg.python.org/cpython/rev/4aab4e0cd759
changeset:   95715:4aab4e0cd759
parent:      95713:cb619f1c616b
parent:      95714:d2edac11d57c
user:        Serhiy Storchaka <storchaka at gmail.com>
date:        Sun Apr 19 21:13:00 2015 +0300
summary:
  Fixed error message for the "u#" format code.

files:
  Python/getargs.c |  7 ++++---
  1 files changed, 4 insertions(+), 3 deletions(-)


diff --git a/Python/getargs.c b/Python/getargs.c
--- a/Python/getargs.c
+++ b/Python/getargs.c
@@ -967,7 +967,7 @@
         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) {
@@ -982,10 +982,11 @@
                 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)) {

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list