components/python/python26/patches/Python26-21-getpass.patch
changeset 841 1a62cefa636d
parent 840 926eb95ceab3
child 842 9da05efee3cd
equal deleted inserted replaced
840:926eb95ceab3 841:1a62cefa636d
     1 diff --git Python-2.6.4/Lib/getpass.py Python-2.6.4/Lib/getpass.py
       
     2 --- Python-2.6.4/Lib/getpass.py
       
     3 +++ Python-2.6.4/Lib/getpass.py
       
     4 @@ -62,12 +62,16 @@
       
     5          try:
       
     6              old = termios.tcgetattr(fd)     # a copy to save
       
     7              new = old[:]
       
     8 -            new[3] &= ~termios.ECHO  # 3 == 'lflags'
       
     9 +            new[3] &= ~(termios.ECHO|termios.ISIG)  # 3 == 'lflags'
       
    10 +            tcsetattr_flags = termios.TCSAFLUSH
       
    11 +            if hasattr(termios, 'TCSASOFT'):
       
    12 +                tcsetattr_flags |= termios.TCSASOFT
       
    13              try:
       
    14 -                termios.tcsetattr(fd, termios.TCSADRAIN, new)
       
    15 +                termios.tcsetattr(fd, tcsetattr_flags, new)
       
    16                  passwd = _raw_input(prompt, stream, input=input)
       
    17              finally:
       
    18 -                termios.tcsetattr(fd, termios.TCSADRAIN, old)
       
    19 +                termios.tcsetattr(fd, tcsetattr_flags, old)
       
    20 +                stream.flush()  # issue7208
       
    21          except termios.error, e:
       
    22              if passwd is not None:
       
    23                  # _raw_input succeeded.  The final tcsetattr failed.  Reraise
       
    24 @@ -125,6 +129,7 @@
       
    25      if prompt:
       
    26          stream.write(prompt)
       
    27          stream.flush()
       
    28 +    # NOTE: The Python C API calls flockfile() (and unlock) during readline.
       
    29      line = input.readline()
       
    30      if not line:
       
    31          raise EOFError