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

Add readline.backend for the backend readline uses #112510

Closed
gaogaotiantian opened this issue Nov 29, 2023 · 4 comments
Closed

Add readline.backend for the backend readline uses #112510

gaogaotiantian opened this issue Nov 29, 2023 · 4 comments
Labels
type-feature A feature request or enhancement

Comments

@gaogaotiantian
Copy link
Member

gaogaotiantian commented Nov 29, 2023

Feature or enhancement

Proposal:

Currently we support two backends with readline: GNU readline and editline. They work in a similar way but have some differences. Notably the way to set <tab> as the complete key.

The users need to distinguish the backend at run time, and currently the recommended way is:

if 'libedit' in getattr(readline, '__doc__', ''):

We have worse checks like

readline_doc = getattr(readline, '__doc__', '')
if readline_doc is not None and 'libedit' in readline_doc:

in site.py.

It would be nice to provide a more official and clean way to check the backend, instead of querying for the docstring for the module. This is also mentioned in #107748 (comment) by @encukou .

In this proposal, a new attribute backend is added which could be either readline or editline.

Has this already been discussed elsewhere?

This is a minor feature, which does not need previous discussion elsewhere

Links to previous discussion of this feature:

No response

Linked PRs

@gaogaotiantian gaogaotiantian added the type-feature A feature request or enhancement label Nov 29, 2023
encukou pushed a commit that referenced this issue Dec 1, 2023
…12511)


Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Donghee Na <donghee.na92@gmail.com>
@encukou
Copy link
Member

encukou commented Dec 1, 2023

Thank you for adding it!

@encukou encukou closed this as completed Dec 1, 2023
aisk pushed a commit to aisk/cpython that referenced this issue Feb 11, 2024
…pythonGH-112511)


Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Donghee Na <donghee.na92@gmail.com>
@whitequark
Copy link

whitequark commented Jun 29, 2024

Could readline.backend be backported to 3.12? It seems that several popular builds of Python (from what I can tell, at least Homebrew and python-build-standalone) have switched to libedit and projects using the builtin readline module functionality are now hitting #121160. It would help if the __doc__ workaround was made unnecessary earlier.

@gaogaotiantian
Copy link
Member Author

I believe Mac is using libedit by default. Unfortunately, this is considered a new feature and I don't think it would be backported to 3.12.

@whitequark
Copy link

Thanks, this is good to know at least.

Glyphack pushed a commit to Glyphack/cpython that referenced this issue Sep 2, 2024
…pythonGH-112511)


Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Donghee Na <donghee.na92@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-feature A feature request or enhancement
Projects
None yet
Development

No branches or pull requests

3 participants