Mercurial > cpython-lru_cache-weakref
comparison Python/errors.c @ 86980:77bebcf5c4cf
Issue #19512: add _PyUnicode_CompareWithId() function
_PyUnicode_CompareWithId() is faster than PyUnicode_CompareWithASCIIString()
when both strings are equal and interned.
Add also _PyId_builtins identifier for "builtins" common string.
| author | Victor Stinner <victor.stinner@gmail.com> |
|---|---|
| date | Thu, 07 Nov 2013 00:46:04 +0100 |
| parents | 954167ce92a3 |
| children | 01c4a0af73cf |
comparison
equal
deleted
inserted
replaced
| 86979:e9a865620788 | 86980:77bebcf5c4cf |
|---|---|
| 876 PyErr_Clear(); | 876 PyErr_Clear(); |
| 877 if (PyFile_WriteString("<unknown>", f) < 0) | 877 if (PyFile_WriteString("<unknown>", f) < 0) |
| 878 goto done; | 878 goto done; |
| 879 } | 879 } |
| 880 else { | 880 else { |
| 881 if (PyUnicode_CompareWithASCIIString(moduleName, "builtins") != 0) { | 881 if (_PyUnicode_CompareWithId(moduleName, &_PyId_builtins) != 0) { |
| 882 if (PyFile_WriteObject(moduleName, f, Py_PRINT_RAW) < 0) | 882 if (PyFile_WriteObject(moduleName, f, Py_PRINT_RAW) < 0) |
| 883 goto done; | 883 goto done; |
| 884 if (PyFile_WriteString(".", f) < 0) | 884 if (PyFile_WriteString(".", f) < 0) |
| 885 goto done; | 885 goto done; |
| 886 } | 886 } |
