Readline: importting `pathlib` breaks libedit `readline.read_init_file` when `.editrc`'s comments are longer than 20 characters
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- Python
- Star
- 77.2k
- Fork
- 35.9k
- Chỉ số merge pull request
- Chỉ số pull request đang chờ
Mô tả
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
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu bằng cách tái hiện vấn đề với tập lệnh khởi động Python, pathlib, readline.read_init_file và một .editrc chứa các chú thích dài hơn 20 ký tự trên libedit. Theo dõi đường đi của readline.read_init_file và xác nhận rằng các thiết lập .editrc được áp dụng khi pathlib được import; việc tái hiện được xem là hoàn tất khi không còn thất bại và hành vi hiện có vẫn được giữ nguyên.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- python
- Lĩnh vực
- cli
- Loại issue
- Lỗi
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 38/100