diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2016-11-16 08:17:58 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2016-11-16 08:17:58 (GMT) |
commit | f4934ea77da38516731a75fbf9458b248d26dd81 (patch) | |
tree | 9fe19276fac7661f433f86673ff7862663ed7693 /Objects/longobject.c | |
parent | 5ebff7b300448db36d0d0eda7d265caa06fce6d2 (diff) | |
download | cpython-f4934ea77da38516731a75fbf9458b248d26dd81.zip cpython-f4934ea77da38516731a75fbf9458b248d26dd81.tar.gz cpython-f4934ea77da38516731a75fbf9458b248d26dd81.tar.bz2 |
Issue #28701: Replace PyUnicode_CompareWithASCIIString with _PyUnicode_EqualToASCIIString.
The latter function is more readable, faster and doesn't raise exceptions.
Diffstat (limited to 'Objects/longobject.c')
-rw-r--r-- | Objects/longobject.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Objects/longobject.c b/Objects/longobject.c index 0cc850e..8510e90 100644 --- a/Objects/longobject.c +++ b/Objects/longobject.c @@ -4936,9 +4936,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, @@ -5019,9 +5019,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, |