Ticket #48807: patch-libedit.diff
File patch-libedit.diff, 7.3 KB (added by mohd-akram (Mohamed Akram), 8 years ago) |
---|
-
configure
old new 14995 14995 $as_echo_n "checking how to link readline libs... " >&6; } 14996 14996 for py_libtermcap in "" tinfo ncursesw ncurses curses termcap; do 14997 14997 if test -z "$py_libtermcap"; then 14998 READLINE_LIBS="-l readline"14998 READLINE_LIBS="-ledit" 14999 14999 else 15000 READLINE_LIBS="-l readline-l$py_libtermcap"15000 READLINE_LIBS="-ledit -l$py_libtermcap" 15001 15001 fi 15002 15002 LIBS="$READLINE_LIBS $LIBS_no_readline" 15003 15003 cat confdefs.h - <<_ACEOF >conftest.$ac_ext … … 15041 15041 fi 15042 15042 15043 15043 # check for readline 2.1 15044 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_callback_handler_install in -l readline" >&515045 $as_echo_n "checking for rl_callback_handler_install in -l readline... " >&6; }15044 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_callback_handler_install in -ledit" >&5 15045 $as_echo_n "checking for rl_callback_handler_install in -ledit... " >&6; } 15046 15046 if ${ac_cv_lib_readline_rl_callback_handler_install+:} false; then : 15047 15047 $as_echo_n "(cached) " >&6 15048 15048 else 15049 15049 ac_check_lib_save_LIBS=$LIBS 15050 LIBS="-l readline$READLINE_LIBS $LIBS"15050 LIBS="-ledit $READLINE_LIBS $LIBS" 15051 15051 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 15052 15052 /* end confdefs.h. */ 15053 15053 … … 15087 15087 # check for readline 2.2 15088 15088 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 15089 15089 /* end confdefs.h. */ 15090 #include < readline/readline.h>15090 #include <editline/readline.h> 15091 15091 _ACEOF 15092 15092 if ac_fn_c_try_cpp "$LINENO"; then : 15093 15093 have_readline=yes … … 15100 15100 then 15101 15101 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 15102 15102 /* end confdefs.h. */ 15103 #include < readline/readline.h>15103 #include <editline/readline.h> 15104 15104 15105 15105 _ACEOF 15106 15106 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | … … 15113 15113 15114 15114 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 15115 15115 /* end confdefs.h. */ 15116 #include < readline/readline.h>15116 #include <editline/readline.h> 15117 15117 15118 15118 _ACEOF 15119 15119 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | … … 15127 15127 fi 15128 15128 15129 15129 # check for readline 4.0 15130 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_pre_input_hook in -l readline" >&515131 $as_echo_n "checking for rl_pre_input_hook in -l readline... " >&6; }15130 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_pre_input_hook in -ledit" >&5 15131 $as_echo_n "checking for rl_pre_input_hook in -ledit... " >&6; } 15132 15132 if ${ac_cv_lib_readline_rl_pre_input_hook+:} false; then : 15133 15133 $as_echo_n "(cached) " >&6 15134 15134 else 15135 15135 ac_check_lib_save_LIBS=$LIBS 15136 LIBS="-l readline$READLINE_LIBS $LIBS"15136 LIBS="-ledit $READLINE_LIBS $LIBS" 15137 15137 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 15138 15138 /* end confdefs.h. */ 15139 15139 … … 15171 15171 15172 15172 15173 15173 # also in 4.0 15174 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_completion_display_matches_hook in -l readline" >&515175 $as_echo_n "checking for rl_completion_display_matches_hook in -l readline... " >&6; }15174 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_completion_display_matches_hook in -ledit" >&5 15175 $as_echo_n "checking for rl_completion_display_matches_hook in -ledit... " >&6; } 15176 15176 if ${ac_cv_lib_readline_rl_completion_display_matches_hook+:} false; then : 15177 15177 $as_echo_n "(cached) " >&6 15178 15178 else 15179 15179 ac_check_lib_save_LIBS=$LIBS 15180 LIBS="-l readline$READLINE_LIBS $LIBS"15180 LIBS="-ledit $READLINE_LIBS $LIBS" 15181 15181 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 15182 15182 /* end confdefs.h. */ 15183 15183 … … 15259 15259 15260 15260 15261 15261 # check for readline 4.2 15262 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_completion_matches in -l readline" >&515263 $as_echo_n "checking for rl_completion_matches in -l readline... " >&6; }15262 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_completion_matches in -ledit" >&5 15263 $as_echo_n "checking for rl_completion_matches in -ledit... " >&6; } 15264 15264 if ${ac_cv_lib_readline_rl_completion_matches+:} false; then : 15265 15265 $as_echo_n "(cached) " >&6 15266 15266 else 15267 15267 ac_check_lib_save_LIBS=$LIBS 15268 LIBS="-l readline$READLINE_LIBS $LIBS"15268 LIBS="-ledit $READLINE_LIBS $LIBS" 15269 15269 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 15270 15270 /* end confdefs.h. */ 15271 15271 … … 15305 15305 # also in readline 4.2 15306 15306 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 15307 15307 /* end confdefs.h. */ 15308 #include < readline/readline.h>15308 #include <editline/readline.h> 15309 15309 _ACEOF 15310 15310 if ac_fn_c_try_cpp "$LINENO"; then : 15311 15311 have_readline=yes … … 15318 15318 then 15319 15319 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 15320 15320 /* end confdefs.h. */ 15321 #include < readline/readline.h>15321 #include <editline/readline.h> 15322 15322 15323 15323 _ACEOF 15324 15324 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | -
setup.py
old new 710 710 libraries=math_libs) ) 711 711 712 712 # readline 713 do_readline = self.compiler.find_library_file(lib_dirs, ' readline')713 do_readline = self.compiler.find_library_file(lib_dirs, 'edit') 714 714 readline_termcap_library = "" 715 715 curses_library = "" 716 716 # Cannot use os.popen here in py3k. … … 776 776 else: 777 777 readline_extra_link_args = () 778 778 779 readline_libs = [' readline']779 readline_libs = ['edit'] 780 780 if readline_termcap_library: 781 781 pass # Issue 7384: Already linked against curses or tinfo. 782 782 elif curses_library: -
Modules/readline.c
old new 29 29 30 30 /* GNU readline definitions */ 31 31 #undef HAVE_CONFIG_H /* Else readline/chardefs.h includes strings.h */ 32 #include <readline/readline.h> 33 #include <readline/history.h> 32 #include <editline/readline.h> 34 33 35 34 #ifdef HAVE_RL_COMPLETION_MATCHES 36 35 #define completion_matches(x, y) \ … … 46 45 #endif 47 46 #endif 48 47 49 #if def __APPLE__48 #ifndef __APPLE__ 50 49 /* 51 50 * It is possible to link the readline module to the readline 52 51 * emulation library of editline/libedit. … … 1099 1098 Py_FatalError("not enough memory to save locale"); 1100 1099 #endif 1101 1100 1102 #if def __APPLE__1101 #ifndef __APPLE__ 1103 1102 /* the libedit readline emulation resets key bindings etc 1104 1103 * when calling rl_initialize. So call it upfront 1105 1104 */ … … 1146 1145 mod_state->begidx = PyLong_FromLong(0L); 1147 1146 mod_state->endidx = PyLong_FromLong(0L); 1148 1147 1149 #if def __APPLE__1148 #ifndef __APPLE__ 1150 1149 if (!using_libedit_emulation) 1151 1150 #endif 1152 1151 { … … 1168 1167 * XXX: A bug in the readline-2.2 library causes a memory leak 1169 1168 * inside this function. Nothing we can do about it. 1170 1169 */ 1171 #if def __APPLE__1170 #ifndef __APPLE__ 1172 1171 if (using_libedit_emulation) 1173 1172 rl_read_init_file(NULL); 1174 1173 else … … 1348 1347 const char *line; 1349 1348 int length = _py_get_history_length(); 1350 1349 if (length > 0) 1351 #if def __APPLE__1350 #ifndef __APPLE__ 1352 1351 if (using_libedit_emulation) { 1353 1352 /* handle older 0-based or newer 1-based indexing */ 1354 1353 line = (const char *)history_get(length + libedit_history_start - 1)->line; … … 1380 1379 PyDoc_STRVAR(doc_module, 1381 1380 "Importing this module enables command line editing using GNU readline."); 1382 1381 1383 #if def __APPLE__1382 #ifndef __APPLE__ 1384 1383 PyDoc_STRVAR(doc_module_le, 1385 1384 "Importing this module enables command line editing using libedit readline."); 1386 1385 #endif /* __APPLE__ */ … … 1404 1403 PyObject *m; 1405 1404 readlinestate *mod_state; 1406 1405 1407 #if def __APPLE__1406 #ifndef __APPLE__ 1408 1407 if (strncmp(rl_library_version, libedit_version_tag, strlen(libedit_version_tag)) == 0) { 1409 1408 using_libedit_emulation = 1; 1410 1409 }