--- configure.orig	2016-12-18 07:05:07.000000000 +1100
+++ configure	2017-09-12 22:27:49.000000000 +1000
@@ -13904,9 +13904,9 @@
 $as_echo_n "checking how to link readline libs... " >&6; }
 for py_libtermcap in "" 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
@@ -13950,13 +13950,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.  */
 
@@ -13996,7 +13996,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
@@ -14009,7 +14009,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 |
@@ -14022,7 +14022,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 |
@@ -14036,13 +14036,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.  */
 
@@ -14080,13 +14080,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.  */
 
@@ -14124,13 +14124,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.  */
 
@@ -14168,13 +14168,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.  */
 
@@ -14214,7 +14214,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
@@ -14227,7 +14227,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 |
Index: setup.py
===================================================================
--- setup.py.orig
+++ setup.py
@@ -719,7 +719,7 @@ class PyBuildExt(build_ext):
             missing.extend(['imageop'])
 
         # 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 = ""
         # Determine if readline is already linked against curses or tinfo.
@@ -772,7 +772,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:
Index: Modules/readline.c
===================================================================
--- Modules/readline.c.orig
+++ Modules/readline.c
@@ -28,8 +28,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) \