Skip to content

Commit 6334396

Browse files
committed
Catch PyUnicode_AsUTF8() errors.
1 parent b1f13bc commit 6334396

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Modules/_interpretersmodule.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,11 @@ config_from_object(PyObject *configobj, PyInterpreterConfig *config)
402402
}
403403
}
404404
else if (PyUnicode_Check(configobj)) {
405+
const char *utf8 = PyUnicode_AsUTF8(configobj);
406+
if (utf8 == NULL)
407+
{
408+
return -1;
409+
}
405410
if (init_named_config(config, PyUnicode_AsUTF8(configobj)) < 0) {
406411
return -1;
407412
}

0 commit comments

Comments
 (0)