Skip to content

Commit 9e9df93

Browse files
authored
[3.11] gh-109191: Fix build with newer editline (gh-110239) (#110575)
(cherry picked from commit f4cb0d2)
1 parent e913c6f commit 9e9df93

File tree

5 files changed

+36
-1
lines changed

5 files changed

+36
-1
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix compile error when building with recent versions of libedit.

Modules/readline.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ readline_set_completion_display_matches_hook_impl(PyObject *module,
440440
default completion display. */
441441
rl_completion_display_matches_hook =
442442
readlinestate_global->completion_display_matches_hook ?
443-
#if defined(_RL_FUNCTION_TYPEDEF)
443+
#if defined(HAVE_RL_COMPDISP_FUNC_T)
444444
(rl_compdisp_func_t *)on_completion_display_matches_hook : 0;
445445
#else
446446
(VFunction *)on_completion_display_matches_hook : 0;

configure

Lines changed: 17 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

configure.ac

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5918,6 +5918,20 @@ if test "$py_cv_lib_readline" = yes; then
59185918
AC_CHECK_LIB($LIBREADLINE, append_history,
59195919
AC_DEFINE(HAVE_RL_APPEND_HISTORY, 1,
59205920
[Define if readline supports append_history]),,$READLINE_LIBS)
5921+
5922+
# in readline as well as newer editline (April 2023)
5923+
AC_CHECK_TYPE([rl_compdisp_func_t],
5924+
[AC_DEFINE([HAVE_RL_COMPDISP_FUNC_T], [1],
5925+
[Define if readline supports rl_compdisp_func_t])],
5926+
[],
5927+
[
5928+
#include <stdio.h> /* Must be first for Gnu Readline */
5929+
#ifdef WITH_EDITLINE
5930+
# include <editline/readline.h>
5931+
#else
5932+
# include <readline/readline.h>
5933+
#endif
5934+
])
59215935
fi
59225936

59235937
# End of readline checks: restore LIBS

pyconfig.h.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -968,6 +968,9 @@
968968
/* Define if you can turn off readline's signal handling. */
969969
#undef HAVE_RL_CATCH_SIGNAL
970970

971+
/* Define if readline supports rl_compdisp_func_t */
972+
#undef HAVE_RL_COMPDISP_FUNC_T
973+
971974
/* Define if you have readline 2.2 */
972975
#undef HAVE_RL_COMPLETION_APPEND_CHARACTER
973976

0 commit comments

Comments
 (0)