diff Python/pythonrun.c @ 86979:e9a865620788

print_exception(): don't encode the module name to UTF-8 Replace _PyUnicode_AsString()+strcmp() with PyUnicode_CompareWithASCIIString().
author Victor Stinner <victor.stinner@gmail.com>
date Thu, 07 Nov 2013 00:12:30 +0100
parents 954167ce92a3
children 77bebcf5c4cf
line wrap: on
line diff
--- a/Python/pythonrun.c	Thu Nov 07 00:01:51 2013 +0100
+++ b/Python/pythonrun.c	Thu Nov 07 00:12:30 2013 +0100
@@ -1928,10 +1928,9 @@
             err = PyFile_WriteString("<unknown>", f);
         }
         else {
-            char* modstr = _PyUnicode_AsString(moduleName);
-            if (modstr && strcmp(modstr, "builtins"))
+            if (PyUnicode_CompareWithASCIIString(moduleName, "builtins") != 0)
             {
-                err = PyFile_WriteString(modstr, f);
+                err = PyFile_WriteObject(moduleName, f, Py_PRINT_RAW);
                 err += PyFile_WriteString(".", f);
             }
             Py_DECREF(moduleName);