Repository navigation
readline fails to parse some forms of .editrc under editline (libedit) emulation on Mac OS X #57840
Description
Activity
Problem
=======The changes in r87356 for py3k and r87358 for python-2.7 described in bpo-9907 have broken parsing of the initialization file .editrc under editline emulation of readline on Mac OS X.
Background
==========Both readline and editline allow settings customized per program.
For example, .inputrc file for readline::$if Python set editing-mode vi $endifwill be applied only to Python processes.
Similarly, .editrc file for editline::
python:bind -v python:bind ^I rl_completewill be applied only to Python processes on Mac OS X.
This works fine on python-2.6.
It's broken on 2.7 and 3.2 and later because the change in bpo-9907 moved the rl_initialize() call towards the beginning of the setup function.
Solution
========The rl_readline_name variable must be set to "python" **before** the call to rl_initialize(). Attached are patches for 2.7 and 3.2.
- addedtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
on Dec 19, 2011 Thanks for the analysis and patch. Have you tested that your patch does not break the readline module when linking against GNU readline? If not, I can do it.
I did not test against a readline build.
I applied your patch and built the readline module against libreadline and imported it successfully. (I did not try the special parsing feature, but I don’t think it’s needed.)
I can confirm the problem and that the patch fixes the issue.
I'll try to commit a fix later this week.
It appears that Apple's update to editline in OS X 10.9 Mavericks has also broken this patch; with refreshing, it still works with the system editline in 10.8. So, like the fix for bpo-18458, we need to make sure that the fix works with either version of a dynamically loaded libedit.
Zvezdan, it would be good if you would be willing to sign the Python contributor agreement for your patch: https://www.python.org/psf/contrib/contrib-form/
Ned,
I just signed the contributor agreement form.
Thanks for the patch and PR, Zvezdan! Merged for 3.7.0 and 3.8.0.
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields: