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 a3d1d1c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
2 changes: 2 additions & 0 deletions NEWS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@ Other Breaking Changes
`(import [foo [bar]])` is now `(import foo [bar])`
and `(import [foo :as baz])` is now `(import foo :as baz)`.
To import all names from a module, use `(import foo *)`.
* Dropped support for `pyreadline`

Bug Fixes
------------------------------
* Improved error messages for illegal uses of `finally` and `else`.
* Fixed a crash on Windows due to Readline

1.0a3 (released 2021-07-09)
==============================
Expand Down
13 changes: 7 additions & 6 deletions hy/completer.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,14 @@

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/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 a3d1d1c

Please sign in to comment.