summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2015-09-27 22:34:59 +0300
committerSerhiy Storchaka <storchaka@gmail.com>2015-09-27 22:34:59 +0300
commit113843937615b26fe8c0a4402c754c176cb7293a (patch)
treea2d5ca4db3696250c36abb1e2e7896633607990e
parent87d0066f1a4497fd57804c06e1c05401385186aa (diff)
downloadcpython-git-113843937615b26fe8c0a4402c754c176cb7293a.tar.gz
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 a4e5c47ab6..6793215a31 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -81,6 +81,9 @@ Core and Builtins
Library
-------
+- Issue #25203: Failed readline.set_completer_delims() no longer left the
+ module in inconsistent state.
+
- Prevent overflow in _Unpickler_Read.
- Issue #25047: The XML encoding declaration written by Element Tree now
diff --git a/Modules/readline.c b/Modules/readline.c
index b545bca8a9..ad51349bef 100644
--- a/Modules/readline.c
+++ b/Modules/readline.c
@@ -427,10 +427,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