Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ef0056a

Browse files
committed
When sys.stdin.fileno() doesn't work, fall back to default_getpass()
-- don't just die.
1 parent 5fb2631 commit ef0056a

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

Lib/getpass.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,10 @@ def getpass(prompt='Password: '):
2929
else:
3030
return win_getpass(prompt)
3131

32-
fd = sys.stdin.fileno()
32+
try:
33+
fd = sys.stdin.fileno()
34+
except:
35+
return default_getpass(prompt)
3336
old = termios.tcgetattr(fd) # a copy to save
3437
new = old[:]
3538

0 commit comments

Comments
 (0)