`_pyrepl.input.KeymapTranslator` tests for non-existent Unicode category
まだ誰も着手していません。
- 主要言語
- Python
- スター
- 77.2k
- フォーク
- 36k
- PR マージ指標
- PR 指標を取得中
説明
Bug report
Bug description:
The implementation of _pyrepl.input.KeymapTranslator has a check for input with Unicode category "C". This code has been present since the initial commit of the new REPL in #111567. However, no such category is ever returned by unicodedata because there is no "C" entry in the list of category names¹
>>> any(unicodedata.category(chr(n)) == "C" for n in range(sys.maxunicode)) # Python 3.12
False
I'm not familiar enough with _pyrepl to know what the implications of this always-false predicate are, but I do know that the block in question is effectively dead code because of it.
I think this is meant to be a .startswith() check for the Other category identified by UAX #44, i.e. the union of Cc | Cf | Cs | Co | Cn, in line with other usage in _pyrepl.reader. I'll open a PR for that.
¹ the list of category names is hardcoded in makeunicodedata.py rather than derived from UCD, which does define C = Cc | Cf | Cs | Co | Cn in PropertyValueAliases.txt. I don't think there's any version of the unicodedata API that would support returning "C" here, though. Just being a little obsessive.
CPython versions tested on:
CPython main branch
Operating systems tested on:
Linux
Linked PRs
- gh-123683
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
Lib/_pyrepl/input.py の94-95行から始め、Lib/_pyrepl/reader.py における関連する Unicode カテゴリの使用と比較してください。レポートに記載された動作を検証し、関連する _pyrepl テストを調査してください。実装とテストが意図した Unicode カテゴリの処理を正しく反映していれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- cli
- issue の種類
- バグ
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 活発さ
- 停滞
- 明瞭さ
- 明確に書かれている
- 初心者へのやさしさ
- 20/100