summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2013-11-06 23:12:30 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2013-11-06 23:12:30 (GMT)
commit937114f7043d6a52172a34fe04febcc5ed0eaed9 (patch)
tree6844574e8fbf6a266b471ebae21b96eb15147e85
parenteaa2883d15ec7d67b85f125b307116c53566b88b (diff)
downloadcpython-937114f7043d6a52172a34fe04febcc5ed0eaed9.zip
cpython-937114f7043d6a52172a34fe04febcc5ed0eaed9.tar.gz
cpython-937114f7043d6a52172a34fe04febcc5ed0eaed9.tar.bz2
print_exception(): don't encode the module name to UTF-8
Replace _PyUnicode_AsString()+strcmp() with PyUnicode_CompareWithASCIIString().
-rw-r--r--Python/pythonrun.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/Python/pythonrun.c b/Python/pythonrun.c
index e510e6f..e0c8638 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);