Issue #28701: Replace _PyUnicode_CompareWithId with _PyUnicode_EqualToASCIIId.

The latter function is more readable, faster and doesn't raise exceptions.

Based on patch by Xiang Zhang.
This commit is contained in:
Serhiy Storchaka 2016-11-16 15:40:39 +02:00
parent f4934ea77d
commit f5894dd646
5 changed files with 65 additions and 8 deletions

View file

@ -747,7 +747,7 @@ print_exception(PyObject *f, PyObject *value)
err = PyFile_WriteString("<unknown>", f);
}
else {
if (_PyUnicode_CompareWithId(moduleName, &PyId_builtins) != 0)
if (!_PyUnicode_EqualToASCIIId(moduleName, &PyId_builtins))
{
err = PyFile_WriteObject(moduleName, f, Py_PRINT_RAW);
err += PyFile_WriteString(".", f);