mirror of
https://github.com/python/cpython.git
synced 2024-11-23 09:54:58 +08:00
_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);
|
||||
#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);
|
||||
|
Loading…
Reference in New Issue
Block a user