[issue1272] Decode __file__ and co_filename to unicode using fs default

Christian Heimes report at bugs.python.org
Mon Oct 15 02:57:19 CEST 2007


Christian Heimes added the comment:

I found two minor bugs in the fix. In Modules/posixmodule.c the tmpnam()
and tempnam() methods return a PyString instance. Please change line
5373 and 5431 to use PyUnicode_DecodeFSDefault().

Index: Modules/posixmodule.c
===================================================================
--- Modules/posixmodule.c       (Revision 58461)
+++ Modules/posixmodule.c       (Arbeitskopie)
@@ -5370,7 +5370,7 @@
 #endif
     if (name == NULL)
         return PyErr_NoMemory();
-    result = PyString_FromString(name);
+    result = PyUnicode_DecodeFSDefault(name);
     free(name);
     return result;
 }
@@ -5428,7 +5428,7 @@
        Py_XDECREF(err);
        return NULL;
     }
-    return PyString_FromString(buffer);
+    return PyUnicode_DecodeFSDefault(buffer);
 }
 #endif

__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue1272>
__________________________________


More information about the Python-bugs-list mailing list