diff Python/fileutils.c @ 74085:a882aa30a713

_Py_fopen now allows bytes filenames under non-Windows platforms.
author Antoine Pitrou <solipsis@pitrou.net>
date Mon, 19 Dec 2011 18:19:06 +0100
parents 2a140b01d343
children 33dea851f918
line wrap: on
line diff
--- a/Python/fileutils.c	Mon Dec 19 17:16:51 2011 +0100
+++ b/Python/fileutils.c	Mon Dec 19 18:19:06 2011 +0100
@@ -321,8 +321,8 @@
     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);