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:41:31 +02:00
commit 29a5447360
5 changed files with 65 additions and 8 deletions

View file

@ -984,7 +984,7 @@ PyErr_WriteUnraisable(PyObject *obj)
goto done;
}
else {
if (_PyUnicode_CompareWithId(moduleName, &PyId_builtins) != 0) {
if (!_PyUnicode_EqualToASCIIId(moduleName, &PyId_builtins)) {
if (PyFile_WriteObject(moduleName, f, Py_PRINT_RAW) < 0)
goto done;
if (PyFile_WriteString(".", f) < 0)