mirror of
https://github.com/python/cpython.git
synced 2025-09-19 07:00:59 +00:00
Fixed #1578: Problems in win_getpass
This commit is contained in:
parent
2f1019e752
commit
0ec88b33d0
2 changed files with 6 additions and 4 deletions
|
@ -49,10 +49,10 @@ def win_getpass(prompt='Password: ', stream=None):
|
||||||
return default_getpass(prompt, stream)
|
return default_getpass(prompt, stream)
|
||||||
import msvcrt
|
import msvcrt
|
||||||
for c in prompt:
|
for c in prompt:
|
||||||
msvcrt.putch(c)
|
msvcrt.putwch(c)
|
||||||
pw = ""
|
pw = ""
|
||||||
while 1:
|
while 1:
|
||||||
c = msvcrt.getch()
|
c = msvcrt.getwch()
|
||||||
if c == '\r' or c == '\n':
|
if c == '\r' or c == '\n':
|
||||||
break
|
break
|
||||||
if c == '\003':
|
if c == '\003':
|
||||||
|
@ -61,8 +61,8 @@ def win_getpass(prompt='Password: ', stream=None):
|
||||||
pw = pw[:-1]
|
pw = pw[:-1]
|
||||||
else:
|
else:
|
||||||
pw = pw + c
|
pw = pw + c
|
||||||
msvcrt.putch('\r')
|
msvcrt.putwch('\r')
|
||||||
msvcrt.putch('\n')
|
msvcrt.putwch('\n')
|
||||||
return pw
|
return pw
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,8 @@ Extension Modules
|
||||||
Library
|
Library
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
- Issue #1578: Problems in win_getpass
|
||||||
|
|
||||||
|
|
||||||
What's New in Python 3.0a2?
|
What's New in Python 3.0a2?
|
||||||
===========================
|
===========================
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue