Skip to content

Commit 52aad8b

Browse files
committed
Added handling for OSError caused by trying to load a GNU readline shared library in
Python environments like PyPy which have a pure Python implementation of readline.
1 parent 290b70b commit 52aad8b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

cmd2/rl_utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,10 +129,10 @@ def pyreadline_remove_history_item(pos: int) -> None:
129129
import ctypes
130130

131131
readline_lib = ctypes.CDLL(readline.__file__)
132-
except AttributeError: # pragma: no cover
132+
except (AttributeError, OSError): # pragma: no cover
133133
_rl_warn_reason = (
134134
"this application is running in a non-standard Python environment in\n"
135-
"which readline is not loaded dynamically from a shared library file."
135+
"which GNU readline is not loaded dynamically from a shared library file."
136136
)
137137
else:
138138
rl_type = RlType.GNU

0 commit comments

Comments
 (0)