aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1998-09-21 20:00:35 +0000
committerGuido van Rossum <guido@python.org>1998-09-21 20:00:35 +0000
commitef0056ae1a5f6dd2cc10505fb10e7653418d7f1f (patch)
tree001fc82c711a4276f0782cafe0d292249b4bad14 /Lib/getpass.py
parentExplicitly document the fact that the search method returns a MatchObject. (diff)
downloadcpython-ef0056ae1a5f6dd2cc10505fb10e7653418d7f1f.tar.gz
cpython-ef0056ae1a5f6dd2cc10505fb10e7653418d7f1f.tar.bz2
cpython-ef0056ae1a5f6dd2cc10505fb10e7653418d7f1f.zip
When sys.stdin.fileno() doesn't work, fall back to default_getpass()
-- don't just die.
Diffstat (limited to 'Lib/getpass.py')
-rw-r--r--Lib/getpass.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/Lib/getpass.py b/Lib/getpass.py
index be7a2f9049b..f0aea63ac34 100644
--- a/Lib/getpass.py
+++ b/Lib/getpass.py
@@ -29,7 +29,10 @@ def getpass(prompt='Password: '):
else:
return win_getpass(prompt)
- fd = sys.stdin.fileno()
+ try:
+ fd = sys.stdin.fileno()
+ except:
+ return default_getpass(prompt)
old = termios.tcgetattr(fd) # a copy to save
new = old[:]