Commit 2b1cc895 authored by Antoine Pitrou's avatar Antoine Pitrou

_Py_fopen now allows bytes filenames under non-Windows platforms.

parent 923df6f2
......@@ -321,8 +321,8 @@ _Py_fopen(PyObject *path, const char *mode)
return _wfopen(wpath, wmode);
#else
FILE *f;
PyObject *bytes = PyUnicode_EncodeFSDefault(path);
if (bytes == NULL)
PyObject *bytes;
if (!PyUnicode_FSConverter(path, &bytes))
return NULL;
f = fopen(PyBytes_AS_STRING(bytes), mode);
Py_DECREF(bytes);
......
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