]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.12] gh-109191: Fix build with newer editline (gh-110239) (gh-110562)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Mon, 9 Oct 2023 14:01:00 +0000 (16:01 +0200)
committerGitHub <noreply@github.com>
Mon, 9 Oct 2023 14:01:00 +0000 (23:01 +0900)
gh-109191: Fix build with newer editline (gh-110239)
(cherry picked from commit f4cb0d27cc08f490c42a22e646eb73cc7072d54a)

Co-authored-by: Bo Anderson <mail@boanderson.me>
Misc/NEWS.d/next/Build/2023-10-05-11-46-20.gh-issue-109191.imUkVN.rst [new file with mode: 0644]
Modules/readline.c
configure
configure.ac
pyconfig.h.in

diff --git a/Misc/NEWS.d/next/Build/2023-10-05-11-46-20.gh-issue-109191.imUkVN.rst b/Misc/NEWS.d/next/Build/2023-10-05-11-46-20.gh-issue-109191.imUkVN.rst
new file mode 100644 (file)
index 0000000..27e5df7
--- /dev/null
@@ -0,0 +1 @@
+Fix compile error when building with recent versions of libedit.
index 2824105a1875860c5168f77cdbfaa2cd1c2da1bf..9823ebe71da3a5b65b7da29a71f47c5ddaf9a00f 100644 (file)
@@ -442,7 +442,7 @@ readline_set_completion_display_matches_hook_impl(PyObject *module,
        default completion display. */
     rl_completion_display_matches_hook =
         readlinestate_global->completion_display_matches_hook ?
-#if defined(_RL_FUNCTION_TYPEDEF)
+#if defined(HAVE_RL_COMPDISP_FUNC_T)
         (rl_compdisp_func_t *)on_completion_display_matches_hook : 0;
 #else
         (VFunction *)on_completion_display_matches_hook : 0;
index b6f90bcd8c7300cbbe0e2a653c9f39e605e8507f..985b3741349e8e137a873fb24ea90f131b3af28c 100755 (executable)
--- a/configure
+++ b/configure
@@ -25345,6 +25345,25 @@ printf "%s\n" "#define HAVE_RL_APPEND_HISTORY 1" >>confdefs.h
 
 fi
 
+    # in readline as well as newer editline (April 2023)
+    ac_fn_c_check_type "$LINENO" "rl_compdisp_func_t" "ac_cv_type_rl_compdisp_func_t" "
+      #include <stdio.h> /* Must be first for Gnu Readline */
+      #ifdef WITH_EDITLINE
+      # include <editline/readline.h>
+      #else
+      # include <readline/readline.h>
+      # include <readline/history.h>
+      #endif
+
+"
+if test "x$ac_cv_type_rl_compdisp_func_t" = xyes
+then :
+
+printf "%s\n" "#define HAVE_RL_COMPDISP_FUNC_T 1" >>confdefs.h
+
+fi
+
+
 
 
 CFLAGS=$save_CFLAGS
index ba768aea9307144c0ff3364f0889ad0c6e3b1563..2a7a91882640fd76d21b4f9443885ab07e01ff58 100644 (file)
@@ -6213,6 +6213,13 @@ AS_VAR_IF([with_readline], [no], [
       AC_DEFINE([HAVE_RL_APPEND_HISTORY], [1], [Define if readline supports append_history])
     ])
 
+    # in readline as well as newer editline (April 2023)
+    AC_CHECK_TYPE([rl_compdisp_func_t],
+                  [AC_DEFINE([HAVE_RL_COMPDISP_FUNC_T], [1],
+                             [Define if readline supports rl_compdisp_func_t])],
+                  [],
+                  [readline_includes])
+
     m4_undefine([readline_includes])
   ])dnl WITH_SAVE_ENV()
 ])
index ada9dccfef10846e803cec0b2b7bfedbbdfe7cc5..9f858b2d3541d092dae8172b6c80681e15ebed36 100644 (file)
 /* Define if you can turn off readline's signal handling. */
 #undef HAVE_RL_CATCH_SIGNAL
 
+/* Define if readline supports rl_compdisp_func_t */
+#undef HAVE_RL_COMPDISP_FUNC_T
+
 /* Define if you have readline 2.2 */
 #undef HAVE_RL_COMPLETION_APPEND_CHARACTER