[Python-checkins] cpython (merge 3.4 -> default): Issue #22773: fix failing test with old readline versions due to issue #19884.

antoine.pitrou python-checkins at python.org
Tue Nov 4 14:53:32 CET 2014


https://hg.python.org/cpython/rev/be374b8c40c8
changeset:   93381:be374b8c40c8
parent:      93377:205810ca5069
parent:      93380:c4b5a5d44254
user:        Antoine Pitrou <solipsis at pitrou.net>
date:        Tue Nov 04 14:53:01 2014 +0100
summary:
  Issue #22773: fix failing test with old readline versions due to issue #19884.

files:
  Lib/test/test_readline.py |  4 ++++
  Modules/readline.c        |  4 ++++
  2 files changed, 8 insertions(+), 0 deletions(-)


diff --git a/Lib/test/test_readline.py b/Lib/test/test_readline.py
--- a/Lib/test/test_readline.py
+++ b/Lib/test/test_readline.py
@@ -44,6 +44,10 @@
 
 
 class TestReadline(unittest.TestCase):
+
+    @unittest.skipIf(readline._READLINE_VERSION < 0x0600
+                     and "libedit" not in readline.__doc__,
+                     "not supported in this library version")
     def test_init(self):
         # Issue #19884: Ensure that the ANSI sequence "\033[1034h" is not
         # written into stdout when the readline module is imported and stdout
diff --git a/Modules/readline.c b/Modules/readline.c
--- a/Modules/readline.c
+++ b/Modules/readline.c
@@ -1285,5 +1285,9 @@
     mod_state = (readlinestate *) PyModule_GetState(m);
     PyOS_ReadlineFunctionPointer = call_readline;
     setup_readline(mod_state);
+
+    PyModule_AddIntConstant(m, "_READLINE_VERSION", RL_READLINE_VERSION);
+    PyModule_AddIntConstant(m, "_READLINE_RUNTIME_VERSION", rl_readline_version);
+
     return m;
 }

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


More information about the Python-checkins mailing list