Commit ed7916dd authored by Victor Stinner's avatar Victor Stinner

find_module(): use FS encoding to display the missing __init__ warning

parent e3874ed7
...@@ -1736,14 +1736,16 @@ find_module(char *fullname, char *subname, PyObject *path, char *buf, ...@@ -1736,14 +1736,16 @@ find_module(char *fullname, char *subname, PyObject *path, char *buf,
return &fd_package; return &fd_package;
} }
else { else {
char warnstr[MAXPATHLEN+80]; int err;
sprintf(warnstr, "Not importing directory " PyObject *unicode = PyUnicode_DecodeFSDefault(buf);
"'%.*s': missing __init__.py", if (unicode == NULL)
MAXPATHLEN, buf); return NULL;
if (PyErr_WarnEx(PyExc_ImportWarning, err = PyErr_WarnFormat(PyExc_ImportWarning, 1,
warnstr, 1)) { "Not importing directory '%U': missing __init__.py",
unicode);
Py_DECREF(unicode);
if (err)
return NULL; return NULL;
}
} }
} }
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment