[Python-checkins] cpython (merge 3.4 -> 3.5): Issue #25203: Failed readline.set_completer_delims() no longer left the

serhiy.storchaka python-checkins at python.org
Sun Sep 27 21:39:51 CEST 2015


https://hg.python.org/cpython/rev/0d3b64bbc82c
changeset:   98332:0d3b64bbc82c
branch:      3.5
parent:      98328:81869f8608ce
parent:      98330:46aaff5e8945
user:        Serhiy Storchaka <storchaka at gmail.com>
date:        Sun Sep 27 22:38:01 2015 +0300
summary:
  Issue #25203: Failed readline.set_completer_delims() no longer left the
module in inconsistent state.

files:
  Misc/NEWS          |  3 +++
  Modules/readline.c |  9 +++++----
  2 files changed, 8 insertions(+), 4 deletions(-)


diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -21,6 +21,9 @@
 Library
 -------
 
+- Issue #25203: Failed readline.set_completer_delims() no longer left the
+  module in inconsistent state.
+
 - Issue #23329: Allow the ssl module to be built with older versions of
   LibreSSL.
 
diff --git a/Modules/readline.c b/Modules/readline.c
--- a/Modules/readline.c
+++ b/Modules/readline.c
@@ -464,10 +464,11 @@
     /* 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

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list