Readline: importting `pathlib` breaks libedit `readline.read_init_file` when `.editrc`'s comments are longer than 20 characters
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- Python
- Estrellas
- 77.2k
- Forks
- 35.9k
- Métricas de merge de PR
- Métricas de PR pendientes
Descripción
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
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
Comienza reproduciendo el problema con el script de inicio de Python, pathlib, readline.read_init_file y un archivo .editrc que contenga comentarios de más de 20 caracteres en libedit. Sigue la ruta de readline.read_init_file y confirma que se aplican las configuraciones de .editrc cuando se importa pathlib; la reproducción se considera completada cuando deja de fallar y el comportamiento existente permanece intacto.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- python
- Área
- cli
- Tipo de issue
- Error
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 38/100