Decide how to use `echo_char` in `getpass.fallback_getpass`
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- Python
- Estrellas
- 77.2k
- Forks
- 36k
- Métricas de merge de PR
- Métricas de PR pendientes
Descripción
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!
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
Comienza con el punto de entrada getpass.fallback_getpass e inspecciona cómo llama a _check_echo y cómo gestiona echo_char cuando no se pueden controlar las configuraciones del terminal. Determina si la llamada de validación es necesaria en esta ruta de fallback y confirma el comportamiento elegido con las comprobaciones de comportamiento relevantes de getpass.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- python
- Área
- cli
- Tipo de issue
- Refactorización
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Estado de actividad
- Tranquilo
- Claridad
- Bastante claro
- Aptitud para principiantes
- 52/100