If sys.stdin is not a tty, fall back to default_getpass after printing
a warning instead of failing with a termios.error.
diff --git a/Lib/getpass.py b/Lib/getpass.py
index 6b78612..07c89ff 100644
--- a/Lib/getpass.py
+++ b/Lib/getpass.py
@@ -24,6 +24,10 @@
     if stream is None:
         stream = sys.stdout
 
+    if not sys.stdin.isatty():
+        print >>sys.stderr, "Warning: sys.stdin is not a tty."
+        return default_getpass(prompt)
+
     try:
         fd = sys.stdin.fileno()
     except: