--- configure.orig	2011-10-31 13:23:35.000000000 +1100
+++ configure	2011-10-31 13:28:19.000000000 +1100
@@ -20985,9 +20985,9 @@
 echo $ECHO_N "checking how to link readline libs... $ECHO_C" >&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 >conftest.$ac_ext <<_ACEOF
@@ -21060,13 +21060,13 @@
 fi
 
 # check for readline 2.1
-{ echo "$as_me:$LINENO: checking for rl_callback_handler_install in -lreadline" >&5
-echo $ECHO_N "checking for rl_callback_handler_install in -lreadline... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking for rl_callback_handler_install in -ledit" >&5
+echo $ECHO_N "checking for rl_callback_handler_install in -ledit... $ECHO_C" >&6; }
 if test "${ac_cv_lib_readline_rl_callback_handler_install+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lreadline $READLINE_LIBS $LIBS"
+LIBS="-ledit $READLINE_LIBS $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -21137,7 +21137,7 @@
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <readline/readline.h>
+#include <editline/readline.h>
 _ACEOF
 if { (ac_try="$ac_cpp conftest.$ac_ext"
 case "(($ac_try" in
@@ -21172,7 +21172,7 @@
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <readline/readline.h>
+#include <editline/readline.h>
 
 _ACEOF
 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
@@ -21188,13 +21188,13 @@
 fi
 
 # check for readline 4.0
-{ echo "$as_me:$LINENO: checking for rl_pre_input_hook in -lreadline" >&5
-echo $ECHO_N "checking for rl_pre_input_hook in -lreadline... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking for rl_pre_input_hook in -ledit" >&5
+echo $ECHO_N "checking for rl_pre_input_hook in -ledit... $ECHO_C" >&6; }
 if test "${ac_cv_lib_readline_rl_pre_input_hook+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lreadline $READLINE_LIBS $LIBS"
+LIBS="-ledit $READLINE_LIBS $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -21259,13 +21259,13 @@
 
 
 # check for readline 4.2
-{ echo "$as_me:$LINENO: checking for rl_completion_matches in -lreadline" >&5
-echo $ECHO_N "checking for rl_completion_matches in -lreadline... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking for rl_completion_matches in -ledit" >&5
+echo $ECHO_N "checking for rl_completion_matches in -ledit... $ECHO_C" >&6; }
 if test "${ac_cv_lib_readline_rl_completion_matches+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lreadline $READLINE_LIBS $LIBS"
+LIBS="-ledit $READLINE_LIBS $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -21336,7 +21336,7 @@
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <readline/readline.h>
+#include <editline/readline.h>
 _ACEOF
 if { (ac_try="$ac_cpp conftest.$ac_ext"
 case "(($ac_try" in
@@ -21371,7 +21371,7 @@
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <readline/readline.h>
+#include <editline/readline.h>
 
 _ACEOF
 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
--- setup.py.orig	2011-10-31 13:23:35.000000000 +1100
+++ setup.py	2011-10-31 13:32:40.000000000 +1100
@@ -488,7 +488,7 @@
             else:
                 readline_extra_link_args = ()
 
-            readline_libs = ['readline']
+            readline_libs = ['edit']
             if self.compiler.find_library_file(lib_dirs,
                                                  'ncursesw'):
                 readline_libs.append('ncursesw')
--- Modules/readline.c.orig	2007-01-23 03:10:27.000000000 +1100
+++ Modules/readline.c	2011-10-31 14:00:36.000000000 +1100
@@ -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) \
@@ -794,7 +793,6 @@ readline_until_enter_or_signal(char *pro
 			PyEval_SaveThread();	
 #endif
 			if (s < 0) {
-				rl_free_line_state();
 				rl_cleanup_after_signal();
 				rl_callback_handler_remove();
 				*signal = 1;
