diff options
Diffstat (limited to 'contrib/tools/python3/Python/pystrhex.c')
| -rw-r--r-- | contrib/tools/python3/Python/pystrhex.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/contrib/tools/python3/Python/pystrhex.c b/contrib/tools/python3/Python/pystrhex.c index e4f06d76639..af2f5c5dce5 100644 --- a/contrib/tools/python3/Python/pystrhex.c +++ b/contrib/tools/python3/Python/pystrhex.c @@ -2,7 +2,7 @@ #include "Python.h" #include "pycore_strhex.h" // _Py_strhex_with_sep() -#include <stdlib.h> // abs() +#include "pycore_unicodeobject.h" // _PyUnicode_CheckConsistency() static PyObject *_Py_strhex_impl(const char* argbuf, const Py_ssize_t arglen, PyObject* sep, int bytes_per_sep_group, @@ -21,8 +21,6 @@ static PyObject *_Py_strhex_impl(const char* argbuf, const Py_ssize_t arglen, return NULL; } if (PyUnicode_Check(sep)) { - if (PyUnicode_READY(sep)) - return NULL; if (PyUnicode_KIND(sep) != PyUnicode_1BYTE_KIND) { PyErr_SetString(PyExc_ValueError, "sep must be ASCII."); return NULL; @@ -44,8 +42,7 @@ static PyObject *_Py_strhex_impl(const char* argbuf, const Py_ssize_t arglen, else { bytes_per_sep_group = 0; } - - unsigned int abs_bytes_per_sep = abs(bytes_per_sep_group); + unsigned int abs_bytes_per_sep = _Py_ABS_CAST(unsigned int, bytes_per_sep_group); Py_ssize_t resultlen = 0; if (bytes_per_sep_group && arglen > 0) { /* How many sep characters we'll be inserting. */ |
