https://github.com/python/cpython/commit/06b62430843a9f7c6f5a1447275e7e3d170302dd commit: 06b62430843a9f7c6f5a1447275e7e3d170302dd branch: 3.14 author: Miss Islington (bot) <[email protected]> committer: serhiy-storchaka <[email protected]> date: 2026-02-22T08:28:17Z summary:
[3.14] gh-145092: Fix compiler warning for memchr() and wcschr() returning const pointer (GH-145093) (GH-145102) (cherry picked from commit faea32b729e132172d39d54517822e772ad0017a) Co-authored-by: Rudi Heitbaum <[email protected]> files: M Objects/stringlib/fastsearch.h M Python/preconfig.c diff --git a/Objects/stringlib/fastsearch.h b/Objects/stringlib/fastsearch.h index b447865c986bef..26bb0555ca9b6c 100644 --- a/Objects/stringlib/fastsearch.h +++ b/Objects/stringlib/fastsearch.h @@ -69,8 +69,8 @@ STRINGLIB(find_char)(const STRINGLIB_CHAR* s, Py_ssize_t n, STRINGLIB_CHAR ch) and UCS4 representations. */ if (needle != 0) { do { - void *candidate = memchr(p, needle, - (e - p) * sizeof(STRINGLIB_CHAR)); + const void *candidate = memchr(p, needle, + (e - p) * sizeof(STRINGLIB_CHAR)); if (candidate == NULL) return -1; s1 = p; diff --git a/Python/preconfig.c b/Python/preconfig.c index 5b26c75de8b3a0..7b4168c466712a 100644 --- a/Python/preconfig.c +++ b/Python/preconfig.c @@ -584,7 +584,7 @@ _Py_get_xoption(const PyWideStringList *xoptions, const wchar_t *name) for (Py_ssize_t i=0; i < xoptions->length; i++) { const wchar_t *option = xoptions->items[i]; size_t len; - wchar_t *sep = wcschr(option, L'='); + const wchar_t *sep = wcschr(option, L'='); if (sep != NULL) { len = (sep - option); } @@ -615,7 +615,7 @@ preconfig_init_utf8_mode(PyPreConfig *config, const _PyPreCmdline *cmdline) const wchar_t *xopt; xopt = _Py_get_xoption(&cmdline->xoptions, L"utf8"); if (xopt) { - wchar_t *sep = wcschr(xopt, L'='); + const wchar_t *sep = wcschr(xopt, L'='); if (sep) { xopt = sep + 1; if (wcscmp(xopt, L"1") == 0) { _______________________________________________ Python-checkins mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3//lists/python-checkins.python.org Member address: [email protected]
