]> granicus.if.org Git - python/commitdiff
PyArg_Parse*("U"): ensure that the Unicode string is ready
authorVictor Stinner <victor.stinner@gmail.com>
Tue, 29 May 2012 10:30:29 +0000 (12:30 +0200)
committerVictor Stinner <victor.stinner@gmail.com>
Tue, 29 May 2012 10:30:29 +0000 (12:30 +0200)
Python/getargs.c

index 17c4ee5955be598e491727d22902d8967adf6281..9f72fa4ebf36646969ce050b56c0296c948c5543 100644 (file)
@@ -1167,8 +1167,11 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags,
 
     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;