python / python/cpython

Decide how to use `echo_char` in `getpass.fallback_getpass`

Aberta
#140,535 6 comentários 1 reação 0 responsáveis Ver no GitHub

Ninguém assumiu esta issue ainda.

3.14 3.15 stdlib type-bug
Linguagem predominante
Python
Estrelas
77.2k
Forks
36k
Métricas de merge de PRs
Métricas de PR pendentes

Descrição

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:

  1. 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!

Guia de contribuição

Abrir o guia de contribuição

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Direção de pesquisa

Comece pelo ponto de entrada getpass.fallback_getpass e inspecione como ele chama _check_echo e trata echo_char quando as configurações do terminal não podem ser controladas. Determine se a chamada de validação é necessária nesse caminho de fallback e confirme o comportamento escolhido com as verificações de comportamento relevantes de getpass.

Escrita pelo modelo de indexação a partir do texto da issue.

Avaliação

Stack de tecnologia
python
Domínio
cli
Tipo de issue
Refatoração
Dificuldade
3/5
Tempo estimado
1-2 dias
Status de atividade
Pouca atividade
Clareza
Razoavelmente clara
Facilidade para iniciantes
52/100

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.