summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2015-09-27 19:34:59 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2015-09-27 19:34:59 (GMT)
commita8041ae56532863957cb07812e2a523cab6dbce3 (patch)
tree5ce7bac4194562568470c236379df86244f1e848
parent96d2654fc7b1e76773371ccb914457afb3767683 (diff)
downloadcpython-a8041ae56532863957cb07812e2a523cab6dbce3.zip
cpython-a8041ae56532863957cb07812e2a523cab6dbce3.tar.gz
cpython-a8041ae56532863957cb07812e2a523cab6dbce3.tar.bz2
Issue #25203: Failed readline.set_completer_delims() no longer left the
module in inconsistent state.
-rw-r--r--Misc/NEWS3
-rw-r--r--Modules/readline.c9
2 files changed, 8 insertions, 4 deletions
diff --git a/Misc/NEWS b/Misc/NEWS
index 83c50e3..901b9cd 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -37,6 +37,9 @@ Core and Builtins
Library
-------
+- Issue #25203: Failed readline.set_completer_delims() no longer left the
+ module in inconsistent state.
+
- Issue #19143: platform module now reads Windows version from kernel32.dll to
avoid compatibility shims.
diff --git a/Modules/readline.c b/Modules/readline.c
index 244d260..1e98ffb 100644
--- a/Modules/readline.c
+++ b/Modules/readline.c
@@ -355,10 +355,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