Skip to content

Commit ef634b5

Browse files
authored
bpo-33692: pythoninfo detect libedit on Python 3.6 (GH-7293)
Check which readline implementation is used based on the readline docstring.
1 parent 6e3ca64 commit ef634b5

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

Lib/test/pythoninfo.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,14 @@ def format_attr(attr, value):
275275
copy_attributes(info_add, readline, 'readline.%s', attributes,
276276
formatter=format_attr)
277277

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+
278286

279287
def collect_gdb(info_add):
280288
import subprocess

0 commit comments

Comments
 (0)