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