Commit 0238a25b authored by Guido van Rossum's avatar Guido van Rossum

Do the check for lacking sys.stdin.fileno() *before* testing for

Windows.  If sys.stdin doesn't appear to be a real file (characterized
by having a working fileno()), don't use any console specific methods
-- go straight to the default.
parent ef0056ae
......@@ -19,6 +19,10 @@ def getpass(prompt='Password: '):
"""
import sys
try:
fd = sys.stdin.fileno()
except:
return default_getpass(prompt)
try:
import termios, TERMIOS
except ImportError:
......@@ -29,10 +33,6 @@ def getpass(prompt='Password: '):
else:
return win_getpass(prompt)
try:
fd = sys.stdin.fileno()
except:
return default_getpass(prompt)
old = termios.tcgetattr(fd) # a copy to save
new = old[:]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment