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 as e:
if passwd is not None:
# _raw_input succeeded. The final tcsetattr failed. Reraise
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
Library
-------
+- Issue #7246 & Issue #7208: getpass now properly flushes input before
+ reading from stdin so that existing input does not confuse it and
+ lead to incorrect entry or an IOError. It also properly flushes it
+ afterwards to avoid the terminal echoing the input afterwards on
+ OSes such as Solaris.
+
- Issue #7233: Fix a number of two-argument Decimal methods to make
sure that they accept an int or long as the second argument. Also
fix buggy handling of large arguments (those with coefficient longer