bpo-33692: pythoninfo detect libedit on Python 2.7 (#7246) · python/cpython@9994eff (original) (raw)

Original file line number Diff line number Diff line change
@@ -275,6 +275,14 @@ def format_attr(attr, value):
275 275 copy_attributes(info_add, readline, 'readline.%s', attributes,
276 276 formatter=format_attr)
277 277
278 +if not hasattr(readline, "_READLINE_LIBRARY_VERSION"):
279 +# _READLINE_LIBRARY_VERSION has been added to CPython 3.7
280 +doc = getattr(readline, '__doc__', '')
281 +if 'libedit readline' in doc:
282 +info_add('readline.library', 'libedit readline')
283 +elif 'GNU readline' in doc:
284 +info_add('readline.library', 'GNU readline')
285 +
278 286
279 287 def collect_gdb(info_add):
280 288 import subprocess