cpython: b6b8a2171aa3 (original) (raw)

Mercurial > cpython

changeset 85581:b6b8a2171aa3

Issue #18458: Prevent crashes with newer versions of libedit. Its readline emulation has changed from 0-based indexing to 1-based like gnu readline. Original patch by Ronald Oussoren. [#18458]

Ned Deily nad@acm.org
date Fri, 06 Sep 2013 15:16:19 -0700
parents 4b64166d5abb
children a55cbaf9a581
files Misc/NEWS Modules/readline.c
diffstat 2 files changed, 25 insertions(+), 12 deletions(-)[+] [-] Misc/NEWS 3 Modules/readline.c 34

line wrap: on

line diff

--- a/Misc/NEWS +++ b/Misc/NEWS @@ -56,6 +56,9 @@ Core and Builtins Library ------- +- Issue #18458: Prevent crashes with newer versions of libedit. Its readline

--- a/Modules/readline.c +++ b/Modules/readline.c @@ -63,6 +63,8 @@ extern char **completion_matches(char *, / static int using_libedit_emulation = 0; static const char libedit_version_tag[] = "EditLine wrapper"; + +static int libedit_history_start = 0; #endif / APPLE */ #ifdef HAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOK @@ -627,21 +629,21 @@ get_history_item(PyObject *self, PyObjec return NULL; #ifdef APPLE if (using_libedit_emulation) {

+

/* * Apple's readline emulation crashes when * the index is out of range, therefore * test for that and fail gracefully. */

+

#endif /* APPLE */ using_history(); @@ -1178,11 +1191,8 @@ call_readline(FILE *sys_stdin, FILE *sys if (length > 0) #ifdef APPLE if (using_libedit_emulation) {

#endif /* APPLE */ line = (const char *)history_get(length)->line;