Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
:mod:`readline`: Fix a potential crash during tab completion caused by an
out-of-memory error during module initialization.
8 changes: 8 additions & 0 deletions Modules/readline.c
Original file line number Diff line number Diff line change
Expand Up @@ -1382,6 +1382,10 @@ setup_readline(readlinestate *mod_state)
completer_word_break_characters =
strdup(" \t\n`~!@#$%^&*()-=+[{]}\\|;:'\",<>/?");
/* All nonalphanums except '.' */

if (!completer_word_break_characters) {
goto error;
}
#ifdef WITH_EDITLINE
// libedit uses rl_basic_word_break_characters instead of
// rl_completer_word_break_characters as complete delimiter
Expand Down Expand Up @@ -1425,6 +1429,10 @@ setup_readline(readlinestate *mod_state)

RESTORE_LOCALE(saved_locale)
return 0;

error:
RESTORE_LOCALE(saved_locale)
return -1;
}

/* Wrapper around GNU readline that handles signals differently. */
Expand Down
Loading