Expand Up
@@ -315,8 +315,12 @@ _set_char(const char *name, Py_UCS4 *target, PyObject *src, Py_UCS4 dflt)
static int
_set_str(const char *name, PyObject **target, PyObject *src, const char *dflt)
{
if (src == NULL)
if (src == NULL) {
*target = PyUnicode_DecodeASCII(dflt, strlen(dflt), NULL);
if (*target == NULL) {
return -1;
}
}
else {
if (!PyUnicode_Check(src)) {
PyErr_Format(PyExc_TypeError,
Expand Down