PyArg_Parse*("U"): ensure that the Unicode string is ready
This commit is contained in:
parent
87ea780e8e
commit
a1b0c9fc4d
@ -1167,8 +1167,11 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags,
|
|||||||
|
|
||||||
case 'U': { /* PyUnicode object */
|
case 'U': { /* PyUnicode object */
|
||||||
PyObject **p = va_arg(*p_va, PyObject **);
|
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;
|
*p = arg;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
return converterr("str", arg, msgbuf, bufsize);
|
return converterr("str", arg, msgbuf, bufsize);
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user