]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-149707: Fix compiler warning in _ctypes_test on strchr() (#149791)
authorVictor Stinner <vstinner@python.org>
Fri, 15 May 2026 11:04:50 +0000 (13:04 +0200)
committerGitHub <noreply@github.com>
Fri, 15 May 2026 11:04:50 +0000 (13:04 +0200)
commit5465b69255890650df99debb8256e0a7bc68138b
treeb19fb9cf83cb0f69d3d3845451274b8148ce3d27
parent7e98debdf4bfcf1c3f592c9424bc654117c2723e
gh-149707: Fix compiler warning in _ctypes_test on strchr() (#149791)

Change my_strchr() return type to "const char*" (add "const").

Fix the compiler warning:

Modules/_ctypes/_ctypes_test.c: In function 'my_strchr':
Modules/_ctypes/_ctypes_test.c:451:12: warning: return discards
'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
  451 |     return strchr(s, c);
      |            ^~~~~~

When using C23, strchr(text, ch) return type is "const char*" if text
type is "const char*".
Modules/_ctypes/_ctypes_test.c