mirror of
https://github.com/python/cpython.git
synced 2025-10-10 00:43:41 +00:00
Get the needed constants from termios, not TERMIOS.
This commit is contained in:
parent
df48d14f44
commit
1191d0148f
2 changed files with 4 additions and 5 deletions
|
@ -30,12 +30,12 @@ def unix_getpass(prompt='Password: '):
|
||||||
old = termios.tcgetattr(fd) # a copy to save
|
old = termios.tcgetattr(fd) # a copy to save
|
||||||
new = old[:]
|
new = old[:]
|
||||||
|
|
||||||
new[3] = new[3] & ~TERMIOS.ECHO # 3 == 'lflags'
|
new[3] = new[3] & ~termios.ECHO # 3 == 'lflags'
|
||||||
try:
|
try:
|
||||||
termios.tcsetattr(fd, TERMIOS.TCSADRAIN, new)
|
termios.tcsetattr(fd, termios.TCSADRAIN, new)
|
||||||
passwd = _raw_input(prompt)
|
passwd = _raw_input(prompt)
|
||||||
finally:
|
finally:
|
||||||
termios.tcsetattr(fd, TERMIOS.TCSADRAIN, old)
|
termios.tcsetattr(fd, termios.TCSADRAIN, old)
|
||||||
|
|
||||||
sys.stdout.write('\n')
|
sys.stdout.write('\n')
|
||||||
return passwd
|
return passwd
|
||||||
|
@ -103,7 +103,7 @@ def getuser():
|
||||||
|
|
||||||
# Bind the name getpass to the appropriate function
|
# Bind the name getpass to the appropriate function
|
||||||
try:
|
try:
|
||||||
import termios, TERMIOS
|
import termios
|
||||||
except ImportError:
|
except ImportError:
|
||||||
try:
|
try:
|
||||||
import msvcrt
|
import msvcrt
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
# Author: Steen Lumholt.
|
# Author: Steen Lumholt.
|
||||||
|
|
||||||
from TERMIOS import *
|
|
||||||
from termios import *
|
from termios import *
|
||||||
|
|
||||||
# Indexes for termios list.
|
# Indexes for termios list.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue