_Py_fopen now allows bytes filenames under non-Windows platforms.
This commit is contained in:
parent
923df6f22a
commit
2b1cc89572
|
@ -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);
|
||||||
|
|
Loading…
Reference in New Issue