diff Python/getargs.c @ 62197:2cfe15b3cdf5

PyArg_Parse*("Z#") raises an error for unknown type instead of ignoring the error and leave the pointer to the string and the size unchanged (not initialized). Fix also the type in the error message of "Z", "Z#" and "Y" formats.
author Victor Stinner <victor.stinner@haypocalc.com>
date Tue, 08 Jun 2010 21:45:51 +0000
parents c3f2ed4d8e65
children d7113cacd428
line wrap: on
line diff
--- a/Python/getargs.c	Tue Jun 08 21:00:13 2010 +0000
+++ b/Python/getargs.c	Tue Jun 08 21:45:51 2010 +0000
@@ -1051,6 +1051,8 @@
                 *p = PyUnicode_AS_UNICODE(arg);
                 STORE_SIZE(PyUnicode_GET_SIZE(arg));
             }
+            else
+                return converterr("str or None", arg, msgbuf, bufsize);
             format++;
         } else {
             Py_UNICODE **p = va_arg(*p_va, Py_UNICODE **);
@@ -1060,8 +1062,7 @@
             else if (PyUnicode_Check(arg))
                 *p = PyUnicode_AS_UNICODE(arg);
             else
-                return converterr("string or None",
-                                  arg, msgbuf, bufsize);
+                return converterr("str or None", arg, msgbuf, bufsize);
         }
         break;
     }
@@ -1258,7 +1259,7 @@
         if (PyByteArray_Check(arg))
             *p = arg;
         else
-            return converterr("buffer", arg, msgbuf, bufsize);
+            return converterr("bytearray", arg, msgbuf, bufsize);
         break;
     }