]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-33692: pythoninfo detect libedit on Python 2.7 (#7246)
authorVictor Stinner <vstinner@redhat.com>
Wed, 30 May 2018 21:36:04 +0000 (23:36 +0200)
committerGitHub <noreply@github.com>
Wed, 30 May 2018 21:36:04 +0000 (23:36 +0200)
Check which readline implementation is used based on the readline
docstring.

Lib/test/pythoninfo.py

index f40ff8d0eba1fe1e43c2d5822416ae5b12db7e14..92b51580399162b727dd22e078876858f86dddbd 100644 (file)
@@ -275,6 +275,14 @@ def collect_readline(info_add):
     copy_attributes(info_add, readline, 'readline.%s', attributes,
                     formatter=format_attr)
 
+    if not hasattr(readline, "_READLINE_LIBRARY_VERSION"):
+        # _READLINE_LIBRARY_VERSION has been added to CPython 3.7
+        doc = getattr(readline, '__doc__', '')
+        if 'libedit readline' in doc:
+            info_add('readline.library', 'libedit readline')
+        elif 'GNU readline' in doc:
+            info_add('readline.library', 'GNU readline')
+
 
 def collect_gdb(info_add):
     import subprocess