[Patches] [ python-Patches-562492 ] Prevent duplicates in readline history

noreply@sourceforge.net noreply@sourceforge.net
Tue, 11 Jun 2002 07:33:37 -0700


Patches item #562492, was opened at 2002-05-30 12:47
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=562492&group_id=5470

Category: Modules
Group: Python 2.3
>Status: Closed
Resolution: Accepted
Priority: 5
Submitted By: Skip Montanaro (montanaro)
Assigned to: Skip Montanaro (montanaro)
Summary: Prevent duplicates in readline history

Initial Comment:
Someone complained awhile back on c.l.py that Python's readline 
history gets duplicates when you ^P to reexecute the previous 
command.  I believe the attached patch fixes that.  As far as I could 
tell, the memory returned by history_get_history_state() is malloc'd, 
though that's not documented in the version of the history docs I 
have and I didn't have the source handy to check.  Someone needs 
to verify that before any such change is incorporated into the code 
base.  (I will download the readline/history source and check if 
nobody else can confirm easily.)

Note that I also added a call to using_history() in setup_readline().  I 
believe that's what the history docs indicate you should do, though it 
doesn't seem to be strictly necessary.

Skip


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

>Comment By: Skip Montanaro (montanaro)
Date: 2002-06-11 09:33

Message:
Logged In: YES 
user_id=44345

incorporated as Modules/readline.c 2.50


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

Comment By: Guido van Rossum (gvanrossum)
Date: 2002-06-10 16:11

Message:
Logged In: YES 
user_id=6380

OK, then go for it.

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

Comment By: Skip Montanaro (montanaro)
Date: 2002-06-07 15:15

Message:
Logged In: YES 
user_id=44345

I checked the readline 2.0 and 4.2a sources (the oldest and newest tarballs 
available from ftp.gnu.org).  The history_get_history_state function in both 
versions malloc's the state.

Skip


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

Comment By: Guido van Rossum (gvanrossum)
Date: 2002-06-05 16:59

Message:
Logged In: YES 
user_id=6380

I like this idea, but I suggest that you check the readline 
source to confirm your hypothesis about the need to free
(state). You might want to check different versions of readline 
too -- we're trying to be compatible with readline 2.2 through 
4.x.

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

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=562492&group_id=5470