]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-126456: Fix _pyrepl curses tigetstr() (#126472)
authorVictor Stinner <vstinner@python.org>
Wed, 13 Nov 2024 16:46:10 +0000 (17:46 +0100)
committerGitHub <noreply@github.com>
Wed, 13 Nov 2024 16:46:10 +0000 (17:46 +0100)
Lib/_pyrepl/_minimal_curses.py

index 849617bf7585e469e1ee7a89fbed50a8f56772c0..d884f880f50ac752197873a27d1bb080c6feca75 100644 (file)
@@ -34,7 +34,7 @@ clib.setupterm.argtypes = [ctypes.c_char_p, ctypes.c_int, ctypes.POINTER(ctypes.
 clib.setupterm.restype = ctypes.c_int
 
 clib.tigetstr.argtypes = [ctypes.c_char_p]
-clib.tigetstr.restype = ctypes.POINTER(ctypes.c_char)
+clib.tigetstr.restype = ctypes.c_ssize_t
 
 clib.tparm.argtypes = [ctypes.c_char_p] + 9 * [ctypes.c_int]  # type: ignore[operator]
 clib.tparm.restype = ctypes.c_char_p
@@ -56,7 +56,7 @@ def tigetstr(cap):
     if not isinstance(cap, bytes):
         cap = cap.encode("ascii")
     result = clib.tigetstr(cap)
-    if ctypes.cast(result, ctypes.c_void_p).value == ERR:
+    if result == ERR:
         return None
     return ctypes.cast(result, ctypes.c_char_p).value