diff Python/getargs.c @ 77222:1700fb28d2ab

PyArg_Parse*("U"): ensure that the Unicode string is ready
author Victor Stinner <victor.stinner@gmail.com>
date Tue, 29 May 2012 12:30:29 +0200
parents 8ab37fa24e58
children 29abedd4f4bb
line wrap: on
line diff
--- a/Python/getargs.c	Tue May 29 12:01:47 2012 +0100
+++ b/Python/getargs.c	Tue May 29 12:30:29 2012 +0200
@@ -1167,8 +1167,11 @@
 
     case 'U': { /* PyUnicode object */
         PyObject **p = va_arg(*p_va, PyObject **);
-        if (PyUnicode_Check(arg))
+        if (PyUnicode_Check(arg)) {
+            if (PyUnicode_READY(arg) == -1)
+                RETURN_ERR_OCCURRED;
             *p = arg;
+        }
         else
             return converterr("str", arg, msgbuf, bufsize);
         break;