mirror of
https://github.com/python/cpython.git
synced 2025-11-25 04:34:37 +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:
commit
1a73bf365e
22 changed files with 125 additions and 80 deletions
|
|
@ -5166,9 +5166,9 @@ long_to_bytes(PyLongObject *v, PyObject *args, PyObject *kwds)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
if (!PyUnicode_CompareWithASCIIString(byteorder_str, "little"))
|
||||
if (_PyUnicode_EqualToASCIIString(byteorder_str, "little"))
|
||||
little_endian = 1;
|
||||
else if (!PyUnicode_CompareWithASCIIString(byteorder_str, "big"))
|
||||
else if (_PyUnicode_EqualToASCIIString(byteorder_str, "big"))
|
||||
little_endian = 0;
|
||||
else {
|
||||
PyErr_SetString(PyExc_ValueError,
|
||||
|
|
@ -5249,9 +5249,9 @@ long_from_bytes(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
if (!PyUnicode_CompareWithASCIIString(byteorder_str, "little"))
|
||||
if (_PyUnicode_EqualToASCIIString(byteorder_str, "little"))
|
||||
little_endian = 1;
|
||||
else if (!PyUnicode_CompareWithASCIIString(byteorder_str, "big"))
|
||||
else if (_PyUnicode_EqualToASCIIString(byteorder_str, "big"))
|
||||
little_endian = 0;
|
||||
else {
|
||||
PyErr_SetString(PyExc_ValueError,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue