]> granicus.if.org Git - python/commitdiff
run_file(): encode the filename with PyUnicode_EncodeFSDefault() instead of
authorVictor Stinner <victor.stinner@haypocalc.com>
Sun, 17 Oct 2010 19:34:51 +0000 (19:34 +0000)
committerVictor Stinner <victor.stinner@haypocalc.com>
Sun, 17 Oct 2010 19:34:51 +0000 (19:34 +0000)
PyUnicode_AsUTF8String()

Modules/main.c

index 0c38fac24e95f5b65aee4d9c68c18ed4883326cc..7df883c8bb7d0e0fca5a51d41116d486d958d7a5 100644 (file)
@@ -280,14 +280,14 @@ run_file(FILE *fp, const wchar_t *filename, PyCompilerFlags *p_cf)
     if (filename) {
         unicode = PyUnicode_FromWideChar(filename, wcslen(filename));
         if (unicode != NULL) {
-            bytes = PyUnicode_AsUTF8String(unicode);
+            bytes = PyUnicode_EncodeFSDefault(unicode);
             Py_DECREF(unicode);
         }
         if (bytes != NULL)
             filename_str = PyBytes_AsString(bytes);
         else {
             PyErr_Clear();
-            filename_str = "<decoding error>";
+            filename_str = "<encoding error>";
         }
     }
     else