_Py_fopen now allows bytes filenames under non-Windows platforms.

This commit is contained in:
Antoine Pitrou 2011-12-19 18:19:06 +01:00
parent 923df6f22a
commit 2b1cc89572
1 changed files with 2 additions and 2 deletions

View File

@ -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);