summaryrefslogtreecommitdiffstats
path: root/contrib/tools/python3/Python/pystrhex.c
diff options
context:
space:
mode:
authorshadchin <[email protected]>2026-02-03 21:59:07 +0300
committershadchin <[email protected]>2026-02-03 22:28:51 +0300
commitbce46f28de392862d5c6c3b185d844ee7c623be3 (patch)
tree424878b5b90144f98970ce4a2745990c77330ad2 /contrib/tools/python3/Python/pystrhex.c
parent0e0ee9fa48ce9411b4038aa769493d22ff6c10a2 (diff)
Import Python 3.13.11
commit_hash:bbb53cefb159aa3e7afaa475fd19d5a03b66945f
Diffstat (limited to 'contrib/tools/python3/Python/pystrhex.c')
-rw-r--r--contrib/tools/python3/Python/pystrhex.c7
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. */