Readline: importting `pathlib` breaks libedit `readline.read_init_file` when `.editrc`'s comments are longer than 20 characters
Nessuno ha ancora preso questa issue.
- Lingua principale
- Python
- Stelle
- 77.2k
- Fork
- 35.9k
- Metriche di merge delle PR
- Metriche PR in attesa
Descrizione
Bug report
Bug description:
Environment
macOS Sonoma 14.3.1
Python 3.12.2
Libedit readline (I tested with my Linux VM and seems that the same bug doesn't appear for libreadline)
Bug Description
When reading .editrc for libedit readline with readline.read_init_file in python startup script, if both these two conditions are true:
- Python startup script imports
pathlib .editrccontains comments with more than 21 characters
.editrc will not be applied to Python REPL. Manually typing readline.read_init_file again in REPL works though.
How to Reproduce the Bug
- Create a minimal python startup script with these lines:
import pathlib
import readline
readline.read_init_file('/path/to/your/editrc')
- Create a minimal
.editrcto test if it is applied (I'm using1's andbind -vhere but you can change them to whatever you want, as long as the comment exceeds 20 characters):
#11111111111111111111
bind -v
- Open your terminal and test whether Vi mode is applied.
- (extra) If you break the comment in
.editrcinto multiple lines, but not adding any1, it still breaks:
#11111111
#111111111111
bind -v
or
#1111
#1111
bind -v
#1111111
#11111
CPython versions tested on:
3.12
Operating systems tested on:
Linux, macOS
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia riproducendo il problema con lo script di avvio Python, pathlib, readline.read_init_file e un file .editrc contenente commenti più lunghi di 20 caratteri su libedit. Traccia il percorso di readline.read_init_file e conferma che le impostazioni di .editrc vengono applicate quando pathlib viene importato; la riproduzione è completa quando non fallisce più e il comportamento esistente rimane invariato.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- python
- Ambito
- cli
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 38/100