From: Antoine Pitrou Date: Mon, 19 Dec 2011 17:19:06 +0000 (+0100) Subject: _Py_fopen now allows bytes filenames under non-Windows platforms. X-Git-Tag: v3.3.0a1~556 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=2b1cc895729710e3e1751f4b1867299821e04c03;p=thirdparty%2FPython%2Fcpython.git _Py_fopen now allows bytes filenames under non-Windows platforms. --- diff --git a/Python/fileutils.c b/Python/fileutils.c index 8c049e02af58..1e71431c0090 100644 --- a/Python/fileutils.c +++ b/Python/fileutils.c @@ -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);