MCPcopy Index your code
hub / github.com/RustPython/RustPython / collect_readline

Function collect_readline

Lib/test/pythoninfo.py:390–416  ·  view source on GitHub ↗
(info_add)

Source from the content-addressed store, hash-verified

388
389
390def collect_readline(info_add):
391 try:
392 import readline
393 except ImportError:
394 return
395
396 def format_attr(attr, value):
397 if isinstance(value, int):
398 return "%#x" % value
399 else:
400 return value
401
402 attributes = (
403 "_READLINE_VERSION",
404 "_READLINE_RUNTIME_VERSION",
405 "_READLINE_LIBRARY_VERSION",
406 )
407 copy_attributes(info_add, readline, 'readline.%s', attributes,
408 formatter=format_attr)
409
410 if not hasattr(readline, "_READLINE_LIBRARY_VERSION"):
411 # _READLINE_LIBRARY_VERSION has been added to CPython 3.7
412 doc = getattr(readline, '__doc__', '')
413 if 'libedit readline' in doc:
414 info_add('readline.library', 'libedit readline')
415 elif 'GNU readline' in doc:
416 info_add('readline.library', 'GNU readline')
417
418
419def collect_gdb(info_add):

Callers

nothing calls this directly

Calls 3

copy_attributesFunction · 0.85
hasattrFunction · 0.85
getattrFunction · 0.85

Tested by

no test coverage detected