|
| 1 | +From 53122bcf825681487226c041d47763e82e081530 Mon Sep 17 00:00:00 2001 |
| 2 | +From: "Miss Islington (bot)" |
| 3 | + |
| 4 | +Date: Mon, 9 Oct 2023 16:01:00 +0200 |
| 5 | +Subject: [PATCH] [3.12] gh-109191: Fix build with newer editline (gh-110239) |
| 6 | + (gh-110562) |
| 7 | + |
| 8 | +gh-109191: Fix build with newer editline (gh-110239) |
| 9 | +(cherry picked from commit f4cb0d27cc08f490c42a22e646eb73cc7072d54a) |
| 10 | + |
| 11 | +Co-authored-by: Bo Anderson < [email protected]> |
| 12 | +--- |
| 13 | + ...-10-05-11-46-20.gh-issue-109191.imUkVN.rst | 1 + |
| 14 | + Modules/readline.c | 2 +- |
| 15 | + configure | 19 +++++++++++++++++++ |
| 16 | + configure.ac | 7 +++++++ |
| 17 | + pyconfig.h.in | 3 +++ |
| 18 | + 5 files changed, 31 insertions(+), 1 deletion(-) |
| 19 | + create mode 100644 Misc/NEWS.d/next/Build/2023-10-05-11-46-20.gh-issue-109191.imUkVN.rst |
| 20 | + |
| 21 | +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 |
| 22 | +new file mode 100644 |
| 23 | +index 00000000000000..27e5df790bc0c6 |
| 24 | +--- /dev/null |
| 25 | ++++ b/Misc/NEWS.d/next/Build/2023-10-05-11-46-20.gh-issue-109191.imUkVN.rst |
| 26 | +@@ -0,0 +1 @@ |
| 27 | ++Fix compile error when building with recent versions of libedit. |
| 28 | +diff --git a/Modules/readline.c b/Modules/readline.c |
| 29 | +index 2824105a187586..9823ebe71da3a5 100644 |
| 30 | +--- a/Modules/readline.c |
| 31 | ++++ b/Modules/readline.c |
| 32 | +@@ -442,7 +442,7 @@ readline_set_completion_display_matches_hook_impl(PyObject *module, |
| 33 | + default completion display. */ |
| 34 | + rl_completion_display_matches_hook = |
| 35 | + readlinestate_global->completion_display_matches_hook ? |
| 36 | +-#if defined(_RL_FUNCTION_TYPEDEF) |
| 37 | ++#if defined(HAVE_RL_COMPDISP_FUNC_T) |
| 38 | + (rl_compdisp_func_t *)on_completion_display_matches_hook : 0; |
| 39 | + #else |
| 40 | + (VFunction *)on_completion_display_matches_hook : 0; |
| 41 | +diff --git a/configure b/configure |
| 42 | +index b6f90bcd8c7300..985b3741349e8e 100755 |
| 43 | +--- a/configure |
| 44 | ++++ b/configure |
| 45 | +@@ -25345,6 +25345,25 @@ printf "%s\n" "#define HAVE_RL_APPEND_HISTORY 1" >>confdefs.h |
| 46 | + |
| 47 | + fi |
| 48 | + |
| 49 | ++ # in readline as well as newer editline (April 2023) |
| 50 | ++ ac_fn_c_check_type "$LINENO" "rl_compdisp_func_t" "ac_cv_type_rl_compdisp_func_t" " |
| 51 | ++ #include <stdio.h> /* Must be first for Gnu Readline */ |
| 52 | ++ #ifdef WITH_EDITLINE |
| 53 | ++ # include <editline/readline.h> |
| 54 | ++ #else |
| 55 | ++ # include <readline/readline.h> |
| 56 | ++ # include <readline/history.h> |
| 57 | ++ #endif |
| 58 | ++ |
| 59 | ++" |
| 60 | ++if test "x$ac_cv_type_rl_compdisp_func_t" = xyes |
| 61 | ++then : |
| 62 | ++ |
| 63 | ++printf "%s\n" "#define HAVE_RL_COMPDISP_FUNC_T 1" >>confdefs.h |
| 64 | ++ |
| 65 | ++fi |
| 66 | ++ |
| 67 | ++ |
| 68 | + |
| 69 | + |
| 70 | + CFLAGS=$save_CFLAGS |
| 71 | +diff --git a/configure.ac b/configure.ac |
| 72 | +index ba768aea930714..2a7a91882640fd 100644 |
| 73 | +--- a/configure.ac |
| 74 | ++++ b/configure.ac |
| 75 | +@@ -6213,6 +6213,13 @@ AS_VAR_IF([with_readline], [no], [ |
| 76 | + AC_DEFINE([HAVE_RL_APPEND_HISTORY], [1], [Define if readline supports append_history]) |
| 77 | + ]) |
| 78 | + |
| 79 | ++ # in readline as well as newer editline (April 2023) |
| 80 | ++ AC_CHECK_TYPE([rl_compdisp_func_t], |
| 81 | ++ [AC_DEFINE([HAVE_RL_COMPDISP_FUNC_T], [1], |
| 82 | ++ [Define if readline supports rl_compdisp_func_t])], |
| 83 | ++ [], |
| 84 | ++ [readline_includes]) |
| 85 | ++ |
| 86 | + m4_undefine([readline_includes]) |
| 87 | + ])dnl WITH_SAVE_ENV() |
| 88 | + ]) |
| 89 | +diff --git a/pyconfig.h.in b/pyconfig.h.in |
| 90 | +index ada9dccfef1084..9f858b2d3541d0 100644 |
| 91 | +--- a/pyconfig.h.in |
| 92 | ++++ b/pyconfig.h.in |
| 93 | +@@ -989,6 +989,9 @@ |
| 94 | + /* Define if you can turn off readline's signal handling. */ |
| 95 | + #undef HAVE_RL_CATCH_SIGNAL |
| 96 | + |
| 97 | ++/* Define if readline supports rl_compdisp_func_t */ |
| 98 | ++#undef HAVE_RL_COMPDISP_FUNC_T |
| 99 | ++ |
| 100 | + /* Define if you have readline 2.2 */ |
| 101 | + #undef HAVE_RL_COMPLETION_APPEND_CHARACTER |
| 102 | + |
0 commit comments