mirror of
https://github.com/AdaCore/cpython.git
synced 2026-02-12 12:57:15 -08:00
print_exception(): don't encode the module name to UTF-8
Replace _PyUnicode_AsString()+strcmp() with PyUnicode_CompareWithASCIIString().
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user