##// END OF EJS Templates
Final py3 fixes
Marcin Kasperski -
r277:79f687aa default
parent child Browse files
Show More
@@ -240,8 +240,12 b' class PasswordStore(object):'
240 """Physically write to keyring"""
240 """Physically write to keyring"""
241 keyring = import_keyring()
241 keyring = import_keyring()
242 # keyring in general expects unicode.
242 # keyring in general expects unicode.
243 # Mercurial provides "local" encoding. See #33
243 # Mercurial provides "local" encoding. See #33.
244 password = encoding.fromlocal(password).decode('utf-8')
244 # py3 adds even more fun as we get already unicode from getpass.
245 # To handle those quirks, let go through encoding.fromlocal in case we
246 # got bytestr here, this will handle both normal py2 and emergency py3 cases.
247 if isinstance(password, bytes):
248 password = encoding.fromlocal(password).decode('utf-8')
245 try:
249 try:
246 keyring.set_password(
250 keyring.set_password(
247 KEYRING_SERVICE, pwdkey, password)
251 KEYRING_SERVICE, pwdkey, password)
General Comments 0
You need to be logged in to leave comments. Login now