summaryrefslogtreecommitdiffstats
path: root/Modules/readline.c
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2015-09-27 19:38:33 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2015-09-27 19:38:33 (GMT)
commita6c5d53eec87028ba3b68e9b471a9215b2e1bc85 (patch)
tree2f437123b255f5315cf058f0c61062241c51cf49 /Modules/readline.c
parentace12ee11e27bab1586dc8cfdacea8e69fd6f25d (diff)
parent36aff2db4ae7e113a8fce91b46301bd85e9c2f3b (diff)
downloadcpython-a6c5d53eec87028ba3b68e9b471a9215b2e1bc85.zip
cpython-a6c5d53eec87028ba3b68e9b471a9215b2e1bc85.tar.gz
cpython-a6c5d53eec87028ba3b68e9b471a9215b2e1bc85.tar.bz2
Issue #25203: Failed readline.set_completer_delims() no longer left the
module in inconsistent state.
Diffstat (limited to 'Modules/readline.c')
-rw-r--r--Modules/readline.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/Modules/readline.c b/Modules/readline.c
index 09877f2..451a6ed 100644
--- a/Modules/readline.c
+++ b/Modules/readline.c
@@ -464,10 +464,11 @@ set_completer_delims(PyObject *self, PyObject *args)
/* Keep a reference to the allocated memory in the module state in case
some other module modifies rl_completer_word_break_characters
(see issue #17289). */
- free(completer_word_break_characters);
- completer_word_break_characters = strdup(break_chars);
- if (completer_word_break_characters) {
- rl_completer_word_break_characters = completer_word_break_characters;
+ break_chars = strdup(break_chars);
+ if (break_chars) {
+ free(completer_word_break_characters);
+ completer_word_break_characters = break_chars;
+ rl_completer_word_break_characters = break_chars;
Py_RETURN_NONE;
}
else