Readline: importting `pathlib` breaks libedit `readline.read_init_file` when `.editrc`'s comments are longer than 20 characters
オープン
まだ誰も着手していません。
type-bug
- 主要言語
- Python
- スター
- 77.2k
- フォーク
- 36k
- PR マージ指標
- PR 指標を取得中
説明
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
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず、Pythonの起動スクリプト、pathlib、readline.read_init_file、およびlibedit上で20文字を超えるコメントを含む.editrcを使って問題を再現します。readline.read_init_fileの経路を追跡し、pathlibのインポート時に.editrcの設定が適用されることを確認します。再現が失敗しなくなり、既存の動作が維持されれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- cli
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 38/100