diff options
Diffstat (limited to 'Lib/getpass.py')
-rw-r--r-- | Lib/getpass.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Lib/getpass.py b/Lib/getpass.py index 0044742193d..6ec6c78824b 100644 --- a/Lib/getpass.py +++ b/Lib/getpass.py @@ -40,6 +40,7 @@ def unix_getpass(prompt='Password: ', stream=None): """ fd = None tty = None + passwd = None try: # Always try reading and writing directly on the tty first. fd = os.open('/dev/tty', os.O_RDWR|os.O_NOCTTY) @@ -47,7 +48,7 @@ def unix_getpass(prompt='Password: ', stream=None): input = tty if not stream: stream = tty - except EnvironmentError as e: + except OSError as e: # If that fails, see if stdin can be controlled. try: fd = sys.stdin.fileno() |