Read about our upcoming Code of Conduct on this issue

Commit 4f78a914 authored by Marcin Kasperski's avatar Marcin Kasperski
Browse files

Final py3 fixes

parent 2e8904dcd77c
......@@ -240,8 +240,12 @@ class PasswordStore(object):
"""Physically write to keyring"""
keyring = import_keyring()
# keyring in general expects unicode.
# Mercurial provides "local" encoding. See #33
password = encoding.fromlocal(password).decode('utf-8')
# Mercurial provides "local" encoding. See #33.
# py3 adds even more fun as we get already unicode from getpass.
# To handle those quirks, let go through encoding.fromlocal in case we
# got bytestr here, this will handle both normal py2 and emergency py3 cases.
if isinstance(password, bytes):
password = encoding.fromlocal(password).decode('utf-8')
KEYRING_SERVICE, pwdkey, password)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment