summaryrefslogtreecommitdiffstats
path: root/Objects/bytesobject.c
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2023-09-01 16:36:53 (GMT)
committerGitHub <noreply@github.com>2023-09-01 16:36:53 (GMT)
commit578ebc5d5fab2e5e0b87636361c6aeb8d2b287fa (patch)
tree36df000be6a6d903c51fe5db44e9cf93625cadeb /Objects/bytesobject.c
parent03c5a685689fd4891d01caff8da01096fcf73d5a (diff)
downloadcpython-578ebc5d5fab2e5e0b87636361c6aeb8d2b287fa.zip
cpython-578ebc5d5fab2e5e0b87636361c6aeb8d2b287fa.tar.gz
cpython-578ebc5d5fab2e5e0b87636361c6aeb8d2b287fa.tar.bz2
gh-108767: Replace ctype.h functions with pyctype.h functions (#108772)
Replace <ctype.h> locale dependent functions with Python "pyctype.h" locale independent functions: * Replace isalpha() with Py_ISALPHA(). * Replace isdigit() with Py_ISDIGIT(). * Replace isxdigit() with Py_ISXDIGIT(). * Replace tolower() with Py_TOLOWER(). Leave Modules/_sre/sre.c unchanged, it uses locale dependent functions on purpose. Include explicitly <ctype.h> in _decimal.c to get isascii().
Diffstat (limited to 'Objects/bytesobject.c')
-rw-r--r--Objects/bytesobject.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/Objects/bytesobject.c b/Objects/bytesobject.c
index c3a31be..26227dd 100644
--- a/Objects/bytesobject.c
+++ b/Objects/bytesobject.c
@@ -722,11 +722,11 @@ _PyBytes_FormatEx(const char *format, Py_ssize_t format_len,
if (--fmtcnt >= 0)
c = *fmt++;
}
- else if (c >= 0 && isdigit(c)) {
+ else if (c >= 0 && Py_ISDIGIT(c)) {
width = c - '0';
while (--fmtcnt >= 0) {
c = Py_CHARMASK(*fmt++);
- if (!isdigit(c))
+ if (!Py_ISDIGIT(c))
break;
if (width > (PY_SSIZE_T_MAX - ((int)c - '0')) / 10) {
PyErr_SetString(
@@ -761,11 +761,11 @@ _PyBytes_FormatEx(const char *format, Py_ssize_t format_len,
if (--fmtcnt >= 0)
c = *fmt++;
}
- else if (c >= 0 && isdigit(c)) {
+ else if (c >= 0 && Py_ISDIGIT(c)) {
prec = c - '0';
while (--fmtcnt >= 0) {
c = Py_CHARMASK(*fmt++);
- if (!isdigit(c))
+ if (!Py_ISDIGIT(c))
break;
if (prec > (INT_MAX - ((int)c - '0')) / 10) {
PyErr_SetString(