--- configure.orig	2017-08-07 17:59:11.000000000 +1000
+++ configure	2017-09-12 20:54:42.000000000 +1000
@@ -14866,9 +14866,9 @@
 $as_echo_n "checking how to link readline libs... " >&6; }
 for py_libtermcap in "" tinfo ncursesw ncurses curses termcap; do
   if test -z "$py_libtermcap"; then
-    READLINE_LIBS="-lreadline"
+    READLINE_LIBS="-ledit"
   else
-    READLINE_LIBS="-lreadline -l$py_libtermcap"
+    READLINE_LIBS="-ledit -l$py_libtermcap"
   fi
   LIBS="$READLINE_LIBS $LIBS_no_readline"
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -14912,13 +14912,13 @@
 fi
 
 # check for readline 2.1
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_callback_handler_install in -lreadline" >&5
-$as_echo_n "checking for rl_callback_handler_install in -lreadline... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_callback_handler_install in -ledit" >&5
+$as_echo_n "checking for rl_callback_handler_install in -ledit... " >&6; }
 if ${ac_cv_lib_readline_rl_callback_handler_install+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lreadline $READLINE_LIBS $LIBS"
+LIBS="-ledit $READLINE_LIBS $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -14958,7 +14958,7 @@
 # check for readline 2.2
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <readline/readline.h>
+#include <editline/readline.h>
 _ACEOF
 if ac_fn_c_try_cpp "$LINENO"; then :
   have_readline=yes
@@ -14971,7 +14971,7 @@
 then
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <readline/readline.h>
+#include <editline/readline.h>
 
 _ACEOF
 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
@@ -14984,7 +14984,7 @@
 
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <readline/readline.h>
+#include <editline/readline.h>
 
 _ACEOF
 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
@@ -14998,13 +14998,13 @@
 fi
 
 # check for readline 4.0
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_pre_input_hook in -lreadline" >&5
-$as_echo_n "checking for rl_pre_input_hook in -lreadline... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_pre_input_hook in -ledit" >&5
+$as_echo_n "checking for rl_pre_input_hook in -ledit... " >&6; }
 if ${ac_cv_lib_readline_rl_pre_input_hook+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lreadline $READLINE_LIBS $LIBS"
+LIBS="-ledit $READLINE_LIBS $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -15042,13 +15042,13 @@
 
 
 # also in 4.0
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_completion_display_matches_hook in -lreadline" >&5
-$as_echo_n "checking for rl_completion_display_matches_hook in -lreadline... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_completion_display_matches_hook in -ledit" >&5
+$as_echo_n "checking for rl_completion_display_matches_hook in -ledit... " >&6; }
 if ${ac_cv_lib_readline_rl_completion_display_matches_hook+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lreadline $READLINE_LIBS $LIBS"
+LIBS="-ledit $READLINE_LIBS $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -15086,13 +15086,13 @@
 
 
 # also in 4.0, but not in editline
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_resize_terminal in -lreadline" >&5
-$as_echo_n "checking for rl_resize_terminal in -lreadline... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_resize_terminal in -ledit" >&5
+$as_echo_n "checking for rl_resize_terminal in -ledit... " >&6; }
 if ${ac_cv_lib_readline_rl_resize_terminal+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lreadline $READLINE_LIBS $LIBS"
+LIBS="-ledit $READLINE_LIBS $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -15130,13 +15130,13 @@
 
 
 # check for readline 4.2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_completion_matches in -lreadline" >&5
-$as_echo_n "checking for rl_completion_matches in -lreadline... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_completion_matches in -ledit" >&5
+$as_echo_n "checking for rl_completion_matches in -ledit... " >&6; }
 if ${ac_cv_lib_readline_rl_completion_matches+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lreadline $READLINE_LIBS $LIBS"
+LIBS="-ledit $READLINE_LIBS $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -15176,7 +15176,7 @@
 # also in readline 4.2
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <readline/readline.h>
+#include <editline/readline.h>
 _ACEOF
 if ac_fn_c_try_cpp "$LINENO"; then :
   have_readline=yes
@@ -15189,7 +15189,7 @@
 then
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <readline/readline.h>
+#include <editline/readline.h>
 
 _ACEOF
 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
@@ -15202,13 +15202,13 @@
 
 fi
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for append_history in -lreadline" >&5
-$as_echo_n "checking for append_history in -lreadline... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for append_history in -ledit" >&5
+$as_echo_n "checking for append_history in -ledit... " >&6; }
 if ${ac_cv_lib_readline_append_history+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lreadline $READLINE_LIBS $LIBS"
+LIBS="-ledit $READLINE_LIBS $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
--- setup.py.orig
+++ setup.py
@@ -708,7 +708,7 @@ class PyBuildExt(build_ext):
                                libraries=math_libs) )
 
         # readline
-        do_readline = self.compiler.find_library_file(lib_dirs, 'readline')
+        do_readline = self.compiler.find_library_file(lib_dirs, 'edit')
         readline_termcap_library = ""
         curses_library = ""
         # Cannot use os.popen here in py3k.
@@ -774,7 +774,7 @@ class PyBuildExt(build_ext):
             else:
                 readline_extra_link_args = ()
 
-            readline_libs = ['readline']
+            readline_libs = ['edit']
             if readline_termcap_library:
                 pass # Issue 7384: Already linked against curses or tinfo.
             elif curses_library:
--- Modules/readline.c.orig
+++ Modules/readline.c
@@ -29,8 +29,7 @@
 
 /* GNU readline definitions */
 #undef HAVE_CONFIG_H /* Else readline/chardefs.h includes strings.h */
-#include <readline/readline.h>
-#include <readline/history.h>
+#include <editline/readline.h>
 
 #ifdef HAVE_RL_COMPLETION_MATCHES
 #define completion_matches(x, y) \