]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.14] gh-149707: Fix compiler warning in _ctypes_test on strchr() (#149791) (#149866)
authorVictor Stinner <vstinner@python.org>
Fri, 15 May 2026 11:36:01 +0000 (13:36 +0200)
committerGitHub <noreply@github.com>
Fri, 15 May 2026 11:36:01 +0000 (11:36 +0000)
commit98c036b084e2b468905007f473dbbc233122c56d
treea2df7f3ce73d9590b38d9e2b4e126a09871c5c17
parentcbede46978e00de46e609b0b43ea4722956073aa
[3.14] gh-149707: Fix compiler warning in _ctypes_test on strchr() (#149791) (#149866)

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*".

(cherry picked from commit 5465b69255890650df99debb8256e0a7bc68138b)
Modules/_ctypes/_ctypes_test.c