summaryrefslogtreecommitdiff
path: root/Python/pythonrun.c
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2013-11-07 00:12:30 +0100
committerVictor Stinner <victor.stinner@gmail.com>2013-11-07 00:12:30 +0100
commit05bfe3160e622f7d33904a12c89fe0a155222fff (patch)
tree5cb82a475851e99c7e3db7d61c54c20f6db56b98 /Python/pythonrun.c
parent135c0994eb3f5f03becece2d14750e915ff262eb (diff)
downloadcpython-05bfe3160e622f7d33904a12c89fe0a155222fff.tar.gz
print_exception(): don't encode the module name to UTF-8
Replace _PyUnicode_AsString()+strcmp() with PyUnicode_CompareWithASCIIString().
Diffstat (limited to 'Python/pythonrun.c')
-rw-r--r--Python/pythonrun.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/Python/pythonrun.c b/Python/pythonrun.c
index e510e6f78a..e0c863811a 100644
--- a/Python/pythonrun.c
+++ b/Python/pythonrun.c
@@ -1928,10 +1928,9 @@ print_exception(PyObject *f, PyObject *value)
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);