Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle pyreadline failure (Windows + Python 3.10+) #2115

Merged
merged 1 commit into from
Jul 14, 2021

Conversation

tianon
Copy link
Member

@tianon tianon commented Jul 12, 2021

Closes #2114

This is a bit hacky, but I'm not sure if there's a better way. I'm confident on the setup.py change to avoid even installing pyreadline on Python 3.10+ (which in itself is enough to fix the problem since then the fallback happens properly), but I added more code to handle the AttributeError for cases where pyreadline gets installed separately and thus import readline still pulls it in (I'm not sure which cases actually invoke the import pyreadline fallback code -- maybe older versions of pyreadline? older versions of Python's built-in readline module?).

@Kodiologist
Copy link
Member

It looks like pyreadline is a dead library walking, so I would vote to just remove it entirely, and Windows users will have to use Cygwin if they want a decent CLI, as usual. So the branch except ImportError can be just docomplete = False. As for the other branch, can we do something more specific than checking for AttributeError? I feel like a lot of unforeseen bugs could trigger that.

@tianon
Copy link
Member Author

tianon commented Jul 12, 2021

Yeah, makes perfect sense -- I've just force pushed another go at this that I hope is more in line with what you have in mind. 😄

Copy link
Member

@Kodiologist Kodiologist left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. You can remove the comment referring to the Hy issue (the one referring to the pyreadline issue is useful, though, and should stay), and add a line to NEWS like "Fixed a crash on Windows due to Readline".

Also, axe the explicit pyreadline fallback and dependency (as pyreadline is unmaintained).
@tianon
Copy link
Member Author

tianon commented Jul 12, 2021

Absolutely -- I also added an explicit note about pyreadline, but happy to adjust again if you'd prefer not to even mention that. 👍

@Kodiologist Kodiologist merged commit b70d645 into hylang:master Jul 14, 2021
@tianon tianon deleted the pyreadline-woes branch July 14, 2021 15:35
@liyiliuxingyu
Copy link

Please see this link.
#2114 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Python 3.10 on Windows fails: AttributeError: module 'collections' has no attribute 'Callable'
4 participants