mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
Issue #28701: Replace PyUnicode_CompareWithASCIIString with _PyUnicode_EqualToASCIIString.
The latter function is more readable, faster and doesn't raise exceptions.
This commit is contained in:
parent
5ebff7b300
commit
f4934ea77d
21 changed files with 120 additions and 75 deletions
|
@ -3686,11 +3686,11 @@ xmlparser_getattro(XMLParserObject* self, PyObject* nameobj)
|
|||
{
|
||||
if (PyUnicode_Check(nameobj)) {
|
||||
PyObject* res;
|
||||
if (PyUnicode_CompareWithASCIIString(nameobj, "entity") == 0)
|
||||
if (_PyUnicode_EqualToASCIIString(nameobj, "entity"))
|
||||
res = self->entity;
|
||||
else if (PyUnicode_CompareWithASCIIString(nameobj, "target") == 0)
|
||||
else if (_PyUnicode_EqualToASCIIString(nameobj, "target"))
|
||||
res = self->target;
|
||||
else if (PyUnicode_CompareWithASCIIString(nameobj, "version") == 0) {
|
||||
else if (_PyUnicode_EqualToASCIIString(nameobj, "version")) {
|
||||
return PyUnicode_FromFormat(
|
||||
"Expat %d.%d.%d", XML_MAJOR_VERSION,
|
||||
XML_MINOR_VERSION, XML_MICRO_VERSION);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue