[3.14] gh-77065: Use putwch instead of putch in getpass.win_getpass (GH-134058) (#134059)

gh-77065: Use `putwch` instead of `putch` in `getpass.win_getpass` (GH-134058)
(cherry picked from commit 52a7a22a6b)

Co-authored-by: Semyon Moroz <donbarbos@proton.me>
This commit is contained in:
Miss Islington (bot) 2025-05-15 17:41:37 +02:00 committed by GitHub
parent 31deafb8ee
commit 438f464a5a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -119,9 +119,9 @@ def win_getpass(prompt='Password: ', stream=None, *, echo_char=None):
raise KeyboardInterrupt
if c == '\b':
if echo_char and pw:
msvcrt.putch('\b')
msvcrt.putch(' ')
msvcrt.putch('\b')
msvcrt.putwch('\b')
msvcrt.putwch(' ')
msvcrt.putwch('\b')
pw = pw[:-1]
else:
pw = pw + c