PyArg_Parse*("U"): ensure that the Unicode string is ready

This commit is contained in:
Victor Stinner 2012-05-29 12:30:29 +02:00
parent 87ea780e8e
commit a1b0c9fc4d
1 changed files with 4 additions and 1 deletions

View 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;