Index: setup.py =================================================================== --- setup.py (revision 74735) +++ setup.py (working copy) @@ -546,7 +546,7 @@ # readline do_readline = self.compiler_obj.find_library_file(lib_dirs, 'readline') - if platform == 'darwin': # and os.uname()[2] < '9.': + if platform == 'darwin' and int(os.uname()[2].split('.')[0]) <= 9: # MacOSX 10.4 has a broken readline. Don't try to build # the readline module unless the user has installed a fixed # readline package Index: Modules/readline.c =================================================================== --- Modules/readline.c (revision 74735) +++ Modules/readline.c (working copy) @@ -978,7 +978,7 @@ char *line; HISTORY_STATE *state = history_get_history_state(); if (state->length > 0) - line = history_get(state->length)->line; + line = history_get(state->length-1)->line; else line = ""; if (strcmp(p, line))