Decide how to use `echo_char` in `getpass.fallback_getpass`
まだ誰も着手していません。
- 主要言語
- Python
- スター
- 77.2k
- フォーク
- 35.9k
- PR マージ指標
- PR 指標を取得中
説明
Hello everyone, I am a Chinese high school student. This is my first contribution to cpython on GitHub. If there are any errors, please kindly point them out. Thank you!
I noticed that in the getpass library of Python 3.14, there was a seemingly useless function call in fallback_getpass: _check_echo. This function was originally designed to check if the echo character is valid, but I think this call is redundant because:
- fallback_getpass is only called when the terminal settings cannot be controlled, and the echo_char parameter actually does not work properly at this time
2.In a fallback scenario, even if echo_char is provided, password echo control cannot be implemented
I suggest removing this unnecessary call. Modify the code as follows:
def fallback_getpass(prompt='Password: ', stream=None, *, echo_char=None):
# remove the function call
import warnings
warnings.warn("Can not control echo on the terminal.", GetPassWarning,
stacklevel=2)
if not stream:
stream = sys.stderr
print("Warning: Password input may be echoed.", file=stream)
return _raw_input(prompt, stream, echo_char=echo_char)
By the way,can we make IDLE support getpass?I think it is important for the beginners!
At last,if I say something wrong, please tell me why and forgive me, thank you!
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
getpass.fallback_getpass エントリポイントから始め、ターミナル設定を制御できない場合に、どのように _check_echo を呼び出し、echo_char を処理するかを確認します。このフォールバックパスで検証呼び出しが必要かどうかを判断し、関連する getpass の動作チェックで選択した動作を確認します。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- cli
- issue の種類
- リファクタリング
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 静か
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 52/100