Skip to content

Commit

Permalink
Handle pyreadline failure (Windows + Python 3.10+)
Browse files Browse the repository at this point in the history
Also, axe the explicit pyreadline fallback and dependency (as pyreadline is unmaintained).
  • Loading branch information
tianon committed Jul 12, 2021
1 parent c7b2f47 commit 2c3f1de
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
14 changes: 8 additions & 6 deletions hy/completer.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,15 @@

try:
import readline
except ImportError:
try:
import pyreadline.rlmain
import pyreadline.unicode_helper # NOQA
import readline
except ImportError:
except AttributeError as e:
# https://github.com/hylang/hy/issues/2114
# https://github.com/pyreadline/pyreadline/issues/65
if "module 'collections' has no attribute 'Callable'" in str(e):
docomplete = False
else:
raise
except ImportError:
docomplete = False

if docomplete:
if sys.platform == 'darwin' and 'libedit' in readline.__doc__:
Expand Down
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ def run(self):
'funcparserlib>=0.3.6',
'colorama',
'astor>=0.8 ; python_version < "3.9"',
'pyreadline>=2.1 ; os_name == "nt"',
],
cmdclass=dict(install=Install),
entry_points={
Expand Down

0 comments on commit 2c3f1de

Please sign in to comment.