]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.13] gh-149707: Fix compiler warning in _ctypes_test on strchr() (#149791) (#149867)
authorVictor Stinner <vstinner@python.org>
Fri, 15 May 2026 11:32:58 +0000 (13:32 +0200)
committerGitHub <noreply@github.com>
Fri, 15 May 2026 11:32:58 +0000 (11:32 +0000)
commit782880ba23d1b9a07d190164260076dd38c569e5
treef424b72697e18dbb46f9815de84d1eba803e6fa6
parenta89fafca6522f93d70803ed312ea1a308698e35a
[3.13] gh-149707: Fix compiler warning in _ctypes_test on strchr() (#149791) (#149867)

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