]> granicus.if.org Git - python/commitdiff
Issue #22773: fix failing test with old readline versions due to issue #19884.
authorAntoine Pitrou <solipsis@pitrou.net>
Tue, 4 Nov 2014 13:52:10 +0000 (14:52 +0100)
committerAntoine Pitrou <solipsis@pitrou.net>
Tue, 4 Nov 2014 13:52:10 +0000 (14:52 +0100)
Lib/test/test_readline.py
Modules/readline.c

index 8b778186f1fe32a306585bfc6684b994e68ef9d2..d2a11f2d0222b14e1531c7ad16447bc64778c85a 100644 (file)
@@ -44,6 +44,10 @@ class TestHistoryManipulation (unittest.TestCase):
 
 
 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
index ae838079e36440bcef50799c1ca0e1ddbc41c006..f349d3b109df29640fd93285ebba9e29a1401cf1 100644 (file)
@@ -1285,5 +1285,9 @@ PyInit_readline(void)
     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;
 }