diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2016-11-16 10:19:20 +0200 |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2016-11-16 10:19:20 +0200 |
commit | 3b73ea127892d0e1f9d8f12f88e4f9c0ba0b89b1 (patch) | |
tree | a1a58a83f9d60f7d5d02e5d116bb76ee13c42254 /Objects/longobject.c | |
parent | 21060105d99a9153db44dd88eb750965392fd966 (diff) | |
parent | f4934ea77da38516731a75fbf9458b248d26dd81 (diff) | |
download | cpython-git-3b73ea127892d0e1f9d8f12f88e4f9c0ba0b89b1.tar.gz |
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 a453241b3f..ad239ce84e 100644 --- a/Objects/longobject.c +++ b/Objects/longobject.c @@ -5180,9 +5180,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, @@ -5263,9 +5263,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, |