From e2e2cf2e57127f793db1e4fe7959ac5b3e7038cb Mon Sep 17 00:00:00 2001 From: Bo Anderson Date: Mon, 2 Oct 2023 20:03:42 +0100 Subject: [PATCH 1/5] gh-109191: Fix build with newer editline --- Modules/readline.c | 2 +- configure | 21 +++++++++++++++++++++ configure.ac | 5 +++++ pyconfig.h.in | 3 +++ 4 files changed, 30 insertions(+), 1 deletion(-) diff --git a/Modules/readline.c b/Modules/readline.c index 4b473023c6e524..fde552d124bc77 100644 --- a/Modules/readline.c +++ b/Modules/readline.c @@ -446,7 +446,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; diff --git a/configure b/configure index 0e5f3f64c680b2..254220ff136239 100755 --- a/configure +++ b/configure @@ -24618,6 +24618,27 @@ 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 /* Must be first for Gnu Readline */ + #ifdef WITH_EDITLINE + # include + #else + # include + # include + #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 diff --git a/configure.ac b/configure.ac index 493868130414ee..2d25dd248fb547 100644 --- a/configure.ac +++ b/configure.ac @@ -5992,6 +5992,11 @@ 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() ]) diff --git a/pyconfig.h.in b/pyconfig.h.in index c2c75c96dcaad1..45508e20943c6d 100644 --- a/pyconfig.h.in +++ b/pyconfig.h.in @@ -983,6 +983,9 @@ /* 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 From b56fd6164dbaa5ccaa7e17624d0ad6e16a1f1233 Mon Sep 17 00:00:00 2001 From: Bo Anderson Date: Wed, 4 Oct 2023 14:44:59 +0100 Subject: [PATCH 2/5] configure.ac: correct style Co-authored-by: Erlend E. Aasland --- configure.ac | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index 2d25dd248fb547..96a6e0ffaa2980 100644 --- a/configure.ac +++ b/configure.ac @@ -5993,9 +5993,11 @@ AS_VAR_IF([with_readline], [no], [ ]) # 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]) + 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() From 8da562c3bc1d9f62becfda144d427dd645fd6a81 Mon Sep 17 00:00:00 2001 From: Bo Anderson Date: Wed, 4 Oct 2023 15:09:28 +0100 Subject: [PATCH 3/5] configure: regen --- configure | 2 -- 1 file changed, 2 deletions(-) diff --git a/configure b/configure index 254220ff136239..d666ffd4ba05fd 100755 --- a/configure +++ b/configure @@ -24632,10 +24632,8 @@ fi 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 From 19e59506b87d1e315b89453d02ef1d59c617688b Mon Sep 17 00:00:00 2001 From: "blurb-it[bot]" <43283697+blurb-it[bot]@users.noreply.github.com> Date: Thu, 5 Oct 2023 11:46:21 +0000 Subject: [PATCH 4/5] =?UTF-8?q?=F0=9F=93=9C=F0=9F=A4=96=20Added=20by=20blu?= =?UTF-8?q?rb=5Fit.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../next/Build/2023-10-05-11-46-20.gh-issue-109191.imUkVN.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 Misc/NEWS.d/next/Build/2023-10-05-11-46-20.gh-issue-109191.imUkVN.rst 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 index 00000000000000..f5002022c9aafd --- /dev/null +++ b/Misc/NEWS.d/next/Build/2023-10-05-11-46-20.gh-issue-109191.imUkVN.rst @@ -0,0 +1 @@ +Fix compile error when building with recent versions of libedit From 3ef8145d3476ae3a252297ea9ffde1f015da0ba9 Mon Sep 17 00:00:00 2001 From: "Erlend E. Aasland" Date: Fri, 6 Oct 2023 10:55:58 +0200 Subject: [PATCH 5/5] Update Misc/NEWS.d/next/Build/2023-10-05-11-46-20.gh-issue-109191.imUkVN.rst --- .../next/Build/2023-10-05-11-46-20.gh-issue-109191.imUkVN.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 index f5002022c9aafd..27e5df790bc0c6 100644 --- 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 @@ -1 +1 @@ -Fix compile error when building with recent versions of libedit +Fix compile error when building with recent versions of libedit.