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