patches/Python26-21-getpass.diff
author gheet
Thu, 09 Sep 2010 09:04:33 +0000
branchgnome-2-30
changeset 20077 57e492d904be
permissions -rw-r--r--
2010-09-09 Ghee Teo <[email protected]> Fix bugster#6983063, update license line. * base-specs/libexif-gtk.spec: * base-specs/libspectre.spec: * base-specs/poppler-data.spec: * base-specs/poppler.spec: Fix bugster#6853801, patch from upstream. * patches/Python26-21-getpass.diff: * specs/SUNWPython26.spec:

--- trunk/Lib/getpass.py	2009/10/31 21:23:39	75999
+++ trunk/Lib/getpass.py	2009/10/31 21:26:08	76000
@@ -62,12 +62,16 @@
         try:
             old = termios.tcgetattr(fd)     # a copy to save
             new = old[:]
-            new[3] &= ~termios.ECHO  # 3 == 'lflags'
+            new[3] &= ~(termios.ECHO|termios.ISIG)  # 3 == 'lflags'
+            tcsetattr_flags = termios.TCSAFLUSH
+            if hasattr(termios, 'TCSASOFT'):
+                tcsetattr_flags |= termios.TCSASOFT
             try:
-                termios.tcsetattr(fd, termios.TCSADRAIN, new)
+                termios.tcsetattr(fd, tcsetattr_flags, new)
                 passwd = _raw_input(prompt, stream, input=input)
             finally:
-                termios.tcsetattr(fd, termios.TCSADRAIN, old)
+                termios.tcsetattr(fd, tcsetattr_flags, old)
+                stream.flush()  # issue7208
         except termios.error, e:
             if passwd is not None:
                 # _raw_input succeeded.  The final tcsetattr failed.  Reraise
@@ -125,6 +129,7 @@
     if prompt:
         stream.write(prompt)
         stream.flush()
+    # NOTE: The Python C API calls flockfile() (and unlock) during readline.
     line = input.readline()
     if not line:
         raise EOFError