[Patches] [Patch #102891] Alternative readline module

noreply@sourceforge.net noreply@sourceforge.net
Tue, 16 Jan 2001 02:25:05 -0800


Patch #102891 has been updated. 

Project: python
Category: Modules
Status: Accepted
Submitted by: nascheme
Assigned to : esr
Summary: Alternative readline module

Follow-Ups:

Date: 2001-Jan-16 02:23
By: mwh

Comment:
You could defer the decision between readline and edline until runtime, as
in: (will sf mangle this? we'll see)

Index: Modules/main.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/main.c,v
retrieving revision 1.47
diff -c -r1.47 main.c
*** Modules/main.c      2000/12/15 22:00:54     1.47
--- Modules/main.c      2001/01/16 10:19:45
***************
*** 267,274 ****
            isatty(fileno(stdin))) {
                PyObject *v;
                v = PyImport_ImportModule("readline");
!               if (v == NULL)
                        PyErr_Clear();
                else
                        Py_DECREF(v);
        }
--- 267,280 ----
            isatty(fileno(stdin))) {
                PyObject *v;
                v = PyImport_ImportModule("readline");
!               if (v == NULL) {
                        PyErr_Clear();
+                       v = PyImport_ImportModule("edline");
+                       if (v == NULL)
+                               PyErr_Clear();
+                       else
+                               Py_DECREF(v);
+               }
                else
                        Py_DECREF(v);
        }

(and pyrl's not going to be ready for 2.1, by a country mile...)

-------------------------------------------------------

Date: 2001-Jan-15 21:30
By: nascheme

Comment:
Hmm, I still like pyrl better.  What to do about GNU
readline now that its in Setup.conf?  You can't enable
them both and I don't feel comfortable enough with
autoconf to fix things.  ESR, if you could add the magic
to test for termios that would be cool.  configure should
use readline if its there and fall back to edline if 
termios is available.

Feel free to bounce it back to me if you don't have time.
-------------------------------------------------------

Date: 2001-Jan-03 06:10
By: gvanrossum

Comment:
Neil, this has now status Accepted.  Go ahead and check it in!

-------------------------------------------------------

Date: 2000-Dec-18 14:17
By: gvanrossum

Comment:
Neil, I propose that you check this in.

The edline.c file would need a little work to compile without warnings, and
you should add #HAVE_STRDUP to edline.h (Python makes sure strdup() is
always present).

The comment for Setup.dist "Neil Schemenauer's edline library" sounds a
little strange given that most of the code is by others. Maybe "Neil
Schemenauer's edline wrapper module"?
-------------------------------------------------------

Date: 2000-Dec-17 14:28
By: nascheme

Comment:
I like Michael Hudson's idea of writing a readline
replacement in Python using modules like _curses and termios
better but I had this patch 90% complete before I recieved
his email.  I stripped the editline library down and updated
it for modern Unix systems.  I have no idea if it compiles
on anything other than Linux however.
-------------------------------------------------------

-------------------------------------------------------
For more info, visit:

http://sourceforge.net/patch/?func=detailpatch&patch_id=102891&group_id=5470