[Python-Dev] [1593035] Re: readline problem with python-2.5

Kate Minola kate01123 at gmail.com
Sat Nov 18 20:40:45 CET 2006

I have a fix to my bug report 1593035 regarding
python-2.5 not working with readline on ia64-Linux.
This bug was found while trying to port SAGE
(http://modular.math.washington.edu/sage/) to ia64-Linux.

The problem is caused by the line of Modules/readline.c
in flex_complete()

  return completion_matches(text, *on_completion);

In readline-5.2, completion_matches() is defined in
compat.c as

  char ** completion_matches(const char *,rl_compentry_func_t *);

But in Modules/readline.c completion_matches() by default is
assumed to return an int, and on_completion() is defined as
char *.

To fix the problem, both the function itself and the
second argument need to be cast to the correct types
in Modules/readline.c/flex_complete()

  return (char **) completion_matches(text, (rl_compentry_func_t *)*on_completio

and completion_matches needs to be defined as an external
function.  I added the following else clause to the ifdef
at the top of Modules/readline.c/flex_complete()

#define completion_matches(x, y) \
        rl_completion_matches((x), ((rl_compentry_func_t *)(y)))
extern char ** completion_matches(const char *,rl_compentry_func_t *);

Kate Minola
University of Maryland, College Park

More information about the Python-Dev mailing list