From 7e6b3cd374540ffed54aa2ff9e930fc77f37528b Mon Sep 17 00:00:00 2001 From: Oleg Broytman Date: Sun, 11 Jan 2026 06:11:20 +0300 Subject: [PATCH] lib/python/init.py: Protect `readline.read_init_file()` PyPy3 doesn't implement it. --- lib/python/init.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/python/init.py b/lib/python/init.py index bd1842c..ce7f1f4 100644 --- a/lib/python/init.py +++ b/lib/python/init.py @@ -25,12 +25,13 @@ def init(): try: import rlcompleter # noqa: need for completion import readline - initfile = os.environ.get('INPUTRC') \ - or os.path.expanduser('~/.inputrc') - warnings.filterwarnings( - 'ignore', 'readline.read_init_file() not implemented', - category=UserWarning) - readline.read_init_file(initfile) + if hasattr(readline, 'read_init_file'): # PyPy3 doesn't have it + initfile = os.environ.get('INPUTRC') \ + or os.path.expanduser('~/.inputrc') + warnings.filterwarnings( + 'ignore', 'readline.read_init_file() not implemented', + category=UserWarning) + readline.read_init_file(initfile) # if 'libedit' in readline.__doc__: # readline.parse_and_bind("bind ^I rl_complete") -- 2.47.3