[Python-Dev] readline.clear_history()

Phillip J. Eby pje at telecommunity.com
Wed Aug 27 19:31:53 EDT 2003

At 03:13 PM 8/27/03 -0700, Guido van Rossum wrote:
> > >But there might be a version issue as well.  I have various versions
> > >of the readline sources online just for this purpose (GNU readline is
> > >notorious for not providing an easy way to check at compile-time which
> > >version you are using), and I note that clear_history() is present in
> > >2.2, but not in 2.0.  I seem to recall that 2.2 is the oldest widely
> > >used version, so I think you're safe.
> >
> > Hmmm...  the CVS log for Modules/readline.c makes mention of changes made
> > to assure backward compatibility with readline 2.1 and 2.0, and #ifdefs
> > some items as a result.  I suppose I could wrap a clear_history in the
> > same.
>That's always better, of course.  How old were those log entries?

Last December there's a checkin by you of a patch from Magnus Lie Hetland 
to support 2.0/2.1, on the Python 2.3 branch.  More recently, this support 
was backported to the Python 2.2 maintenance branch, and released in 
2.2.3.  In each case, the change revolves around an #ifdef for 
HAVE_RL_COMPLETION_APPEND_CHARACTER, so presumably I can use the same 
#ifdef to protect clear_history().  (Unless it's preferred to have a 
distinct flag for this, but I have zero autoconf knowledge/experience, so I 
might have to ask someone for help on that part.)

>An extra advantage is that by testing for
>presence of the feature, you can cope with older Python versions is
>the same way as you cope with ancient readline versions.

Excellent point!  I'll do it that way, then.

More information about the Python-Dev mailing list