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