Fix getpass on Windows (Fixes #2547)
This commit is contained in:
parent
17286a96f2
commit
e68301af21
2 changed files with 12 additions and 2 deletions
|
@ -6,6 +6,7 @@ import ctypes
|
|||
import datetime
|
||||
import email.utils
|
||||
import errno
|
||||
import getpass
|
||||
import gzip
|
||||
import itertools
|
||||
import io
|
||||
|
@ -1279,3 +1280,12 @@ def parse_xml(s):
|
|||
parser = xml.etree.ElementTree.XMLParser(target=TreeBuilder())
|
||||
kwargs = {'parser': parser} if sys.version_info >= (2, 7) else {}
|
||||
return xml.etree.ElementTree.XML(s.encode('utf-8'), **kwargs)
|
||||
|
||||
|
||||
if sys.version_info < (3, 0) and sys.platform == 'win32':
|
||||
def compat_getpass(prompt, *args, **kwargs):
|
||||
if isinstance(prompt, compat_str):
|
||||
prompt = prompt.encode(getpreferredencoding())
|
||||
return getpass.getpass(prompt, *args, **kwargs)
|
||||
else:
|
||||
compat_getpass = getpass.getpass
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue