mirror of
https://github.com/python/cpython.git
synced 2025-10-15 03:10:29 +00:00
Mod by Jack Jansen: on Macintosh, use EasyDialogs.GetPassword if it
exists.
This commit is contained in:
parent
a598bc412c
commit
c731723730
1 changed files with 8 additions and 1 deletions
|
@ -16,6 +16,8 @@ def getpass(prompt='Password: '):
|
||||||
On Windows, this calls win_getpass(prompt) which uses the
|
On Windows, this calls win_getpass(prompt) which uses the
|
||||||
msvcrt module to get the same effect.
|
msvcrt module to get the same effect.
|
||||||
|
|
||||||
|
On the Mac EasyDialogs.AskPassword is used, if available.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
@ -28,8 +30,13 @@ def getpass(prompt='Password: '):
|
||||||
except ImportError:
|
except ImportError:
|
||||||
try:
|
try:
|
||||||
import msvcrt
|
import msvcrt
|
||||||
|
except ImportError:
|
||||||
|
try:
|
||||||
|
from EasyDialogs import AskPassword
|
||||||
except ImportError:
|
except ImportError:
|
||||||
return default_getpass(prompt)
|
return default_getpass(prompt)
|
||||||
|
else:
|
||||||
|
return AskPassword(prompt)
|
||||||
else:
|
else:
|
||||||
return win_getpass(prompt)
|
return win_getpass(prompt)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue