Skip to content

Commit a1b0c9f

Browse files
committed
PyArg_Parse*("U"): ensure that the Unicode string is ready
1 parent 87ea780 commit a1b0c9f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Python/getargs.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1167,8 +1167,11 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags,
11671167

11681168
case 'U': { /* PyUnicode object */
11691169
PyObject **p = va_arg(*p_va, PyObject **);
1170-
if (PyUnicode_Check(arg))
1170+
if (PyUnicode_Check(arg)) {
1171+
if (PyUnicode_READY(arg) == -1)
1172+
RETURN_ERR_OCCURRED;
11711173
*p = arg;
1174+
}
11721175
else
11731176
return converterr("str", arg, msgbuf, bufsize);
11741177
break;

0 commit comments

Comments
 (0)