[Python-checkins] r85654 - python/branches/py3k/Modules/main.c

victor.stinner python-checkins at python.org
Sun Oct 17 21:34:51 CEST 2010


Author: victor.stinner
Date: Sun Oct 17 21:34:51 2010
New Revision: 85654

Log:
run_file(): encode the filename with PyUnicode_EncodeFSDefault() instead of
PyUnicode_AsUTF8String()


Modified:
   python/branches/py3k/Modules/main.c

Modified: python/branches/py3k/Modules/main.c
==============================================================================
--- python/branches/py3k/Modules/main.c	(original)
+++ python/branches/py3k/Modules/main.c	Sun Oct 17 21:34:51 2010
@@ -280,14 +280,14 @@
     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


More information about the Python-checkins mailing list