[Python-checkins] r81850 - in python/branches/release31-maint: Python/getargs.c

victor.stinner python-checkins at python.org
Tue Jun 8 23:46:32 CEST 2010


Author: victor.stinner
Date: Tue Jun  8 23:46:32 2010
New Revision: 81850

Log:
Merged revisions 81849 via svnmerge from 
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r81849 | victor.stinner | 2010-06-08 23:45:51 +0200 (mar., 08 juin 2010) | 7 lines
  
  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.
........


Modified:
   python/branches/release31-maint/   (props changed)
   python/branches/release31-maint/Python/getargs.c

Modified: python/branches/release31-maint/Python/getargs.c
==============================================================================
--- python/branches/release31-maint/Python/getargs.c	(original)
+++ python/branches/release31-maint/Python/getargs.c	Tue Jun  8 23:46:32 2010
@@ -1048,6 +1048,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 **);
@@ -1057,8 +1059,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;
     }
@@ -1253,7 +1254,7 @@
         if (PyByteArray_Check(arg))
             *p = arg;
         else
-            return converterr("buffer", arg, msgbuf, bufsize);
+            return converterr("bytearray", arg, msgbuf, bufsize);
         break;
     }
 


More information about the Python-checkins mailing list