py3 bytes vs str crash on `hg incoming`
I'm in WSL with Ubuntu 18.04, py3.6.9, and hg 5.4, but I don't think that matters. Keyring has been complaining about the backend not working, and I really haven't investigating. But HGPLAIN=1 causes a crash:
$ HGPLAIN=1 hg in try
*** failed to import extension mercurial_keyring: unicode 'keyring_check [PATH]' found in cmdtable.keyring_check
*** (use b'' to make it byte string)
Error initializing plugin EntryPoint(name='Windows (alt)', value='keyrings.alt.Windows', group='keyring.backends').
Traceback (most recent call last):
File "/home/mharbison/.local/lib/python3.6/site-packages/keyring/backend.py", line 203, in _load_plugins
init_func = ep.load()
File "/home/mharbison/.local/lib/python3.6/site-packages/importlib_metadata/__init__.py", line 95, in load
module = import_module(match.group('module'))
File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/usr/lib/python3/dist-packages/keyrings/alt/Windows.py", line 9, in <module>
from . import file_base
File "/usr/lib/python3/dist-packages/keyrings/alt/file_base.py", line 13, in <module>
from keyring.util.escape import escape as escape_for_ini
ModuleNotFoundError: No module named 'keyring.util.escape'
Error initializing plugin EntryPoint(name='file', value='keyrings.alt.file', group='keyring.backends').
Traceback (most recent call last):
File "/home/mharbison/.local/lib/python3.6/site-packages/keyring/backend.py", line 203, in _load_plugins
init_func = ep.load()
File "/home/mharbison/.local/lib/python3.6/site-packages/importlib_metadata/__init__.py", line 95, in load
module = import_module(match.group('module'))
File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/usr/lib/python3/dist-packages/keyrings/alt/file.py", line 11, in <module>
from keyring.util.escape import escape as escape_for_ini
ModuleNotFoundError: No module named 'keyring.util.escape'
Error initializing plugin EntryPoint(name='pyfs', value='keyrings.alt.pyfs', group='keyring.backends').
Traceback (most recent call last):
File "/home/mharbison/.local/lib/python3.6/site-packages/keyring/backend.py", line 203, in _load_plugins
init_func = ep.load()
File "/home/mharbison/.local/lib/python3.6/site-packages/importlib_metadata/__init__.py", line 95, in load
module = import_module(match.group('module'))
File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/usr/lib/python3/dist-packages/keyrings/alt/pyfs.py", line 8, in <module>
from keyring.util.escape import escape as escape_for_ini
ModuleNotFoundError: No module named 'keyring.util.escape'
comparing with https://vcs.attotech.com/hg/users/bgrove/golang/atto360
** unknown exception encountered, please report by visiting
** https://mercurial-scm.org/wiki/BugTracker
** Python 3.6.9 (default, Apr 18 2020, 01:56:04) [GCC 8.4.0]
** Mercurial Distributed SCM (version 5.4)
** Extensions loaded: extdiff, evolve, topic, phabricator, rebase, absorb, blackbox, strip, show, fix
Traceback (most recent call last):
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial_keyring.py", line 226, in _read_password_from_keyring
password = keyring.get_password(KEYRING_SERVICE, pwdkey)
File "/home/mharbison/.local/lib/python3.6/site-packages/keyring/core.py", line 56, in get_password
return _keyring_backend.get_password(service_name, username)
File "/home/mharbison/.local/lib/python3.6/site-packages/keyring/backends/fail.py", line 25, in get_password
raise NoKeyringError(msg)
keyring.errors.NoKeyringError: No recommended backend was available. Install a recommended 3rd party backend package; or, install the keyrings.alt package if you want to use the non-recommended backends. See https://pypi.org/project/keyring for details.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/mharbison/.local/bin/hg", line 43, in <module>
dispatch.run()
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/dispatch.py", line 112, in run
status = dispatch(req)
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/dispatch.py", line 298, in dispatch
ret = _runcatch(req) or 0
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/dispatch.py", line 472, in _runcatch
return _callcatch(ui, _runcatchfunc)
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/dispatch.py", line 481, in _callcatch
return scmutil.callcatch(ui, func)
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/scmutil.py", line 152, in callcatch
return func()
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/dispatch.py", line 462, in _runcatchfunc
return _dispatch(req)
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/dispatch.py", line 1226, in _dispatch
lui, repo, cmd, fullargs, ui, options, d, cmdpats, cmdoptions
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/dispatch.py", line 910, in runcommand
ret = _runcommand(ui, options, cmd, d)
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/dispatch.py", line 1237, in _runcommand
return cmdfunc()
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/dispatch.py", line 1223, in <lambda>
d = lambda: util.checksignature(func)(ui, *args, **strcmdopt)
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/util.py", line 1864, in check
return func(*args, **kwargs)
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/commands.py", line 4373, in incoming
return hg.incoming(ui, repo, source, opts)
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/hg.py", line 1240, in incoming
return _incoming(display, subreporecurse, ui, repo, source, opts)
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/hg.py", line 1198, in _incoming
ui, repo, other, revs, opts[b"bundle"], opts[b"force"]
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/bundlerepo.py", line 549, in getremotechanges
tmp = discovery.findcommonincoming(repo, peer, heads=onlyheads, force=force)
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/discovery.py", line 67, in findcommonincoming
ancestorsof=ancestorsof,
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/setdiscovery.py", line 374, in findcommonheads
b'known', {b'nodes': [clnode(r) for r in sample],}
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/wireprotov1peer.py", line 141, in __exit__
self.close()
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/wireprotov1peer.py", line 301, in close
self._responsef.result()
File "/usr/lib/python3.6/concurrent/futures/_base.py", line 432, in result
return self.__get_result()
File "/usr/lib/python3.6/concurrent/futures/_base.py", line 384, in __get_result
raise self._exception
File "/usr/lib/python3.6/concurrent/futures/thread.py", line 56, in run
result = self.fn(*self.args, **self.kwargs)
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/wireprotov1peer.py", line 325, in _readbatchresponse
remoteresult = next(wireresults)
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/wireprotov1peer.py", line 580, in _submitbatch
rsp = self._callstream(b"batch", cmds=encodebatchcmds(req))
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/httppeer.py", line 485, in _callstream
resp = sendrequest(self.ui, self._urlopener, req)
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/httppeer.py", line 300, in sendrequest
res = opener.open(req)
File "/usr/lib/python3.6/urllib/request.py", line 532, in open
response = meth(req, response)
File "/usr/lib/python3.6/urllib/request.py", line 642, in http_response
'http', request, response, code, msg, hdrs)
File "/usr/lib/python3.6/urllib/request.py", line 564, in error
result = self._call_chain(*args)
File "/usr/lib/python3.6/urllib/request.py", line 504, in _call_chain
result = func(*args)
File "/usr/lib/python3.6/urllib/request.py", line 1035, in http_error_401
url, req, headers)
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/url.py", line 514, in http_error_auth_reqed
self, auth_header, host, req, headers
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial_keyring.py", line 616, in basic_http_error_auth_reqed
return basic_http_error_auth_reqed.orig(self, authreq, host, req, headers)
File "/usr/lib/python3.6/urllib/request.py", line 988, in http_error_auth_reqed
return self.retry_http_basic_auth(host, req, realm)
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/url.py", line 519, in retry_http_basic_auth
realm, urllibcompat.getfullurl(req)
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial_keyring.py", line 607, in find_user_password
return self._pwd_handler.find_auth(self, realm, authuri, req)
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial_keyring.py", line 424, in find_auth
pwmgr, realm, authuri, skip_caches=after_bad_auth)
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial_keyring.py", line 383, in get_credentials
keyring_pwd = password_store.get_http_password(keyring_url, actual_user)
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial_keyring.py", line 177, in get_http_password
self._format_http_key(url, username))
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial_keyring.py", line 231, in _read_password_from_keyring
err))
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/ui.py", line 1736, in warn
self._writemsg(self._fmsgerr, type=b'warning', *msg, **opts)
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/ui.py", line 1220, in _writemsg
_writemsgwith(self._write, dest, *args, **opts)
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/ui.py", line 2335, in _writemsgwith
write(dest, *args, **opts)
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/ui.py", line 1175, in _write
self._writenobuf(dest, *args, **opts)
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/ui.py", line 1181, in _writenobuf
msg = b''.join(args)
TypeError: sequence item 0: expected a bytes-like object, str found
Error in sys.excepthook:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 57, in apport_excepthook
from cStringIO import StringIO
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 951, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 894, in _find_spec
File "/home/mharbison/.local/lib/python3.6/site-packages/hgdemandimport/demandimportpy3.py", line 102, in find_spec
spec = finder.find_spec(*args, **kwargs)
AttributeError: '_SixMetaPathImporter' object has no attribute 'find_spec'
Original exception was:
Traceback (most recent call last):
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial_keyring.py", line 226, in _read_password_from_keyring
password = keyring.get_password(KEYRING_SERVICE, pwdkey)
File "/home/mharbison/.local/lib/python3.6/site-packages/keyring/core.py", line 56, in get_password
return _keyring_backend.get_password(service_name, username)
File "/home/mharbison/.local/lib/python3.6/site-packages/keyring/backends/fail.py", line 25, in get_password
raise NoKeyringError(msg)
keyring.errors.NoKeyringError: No recommended backend was available. Install a recommended 3rd party backend package; or, install the keyrings.alt package if you want to use the non-recommended backends. See https://pypi.org/project/keyring for details.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/mharbison/.local/bin/hg", line 43, in <module>
dispatch.run()
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/dispatch.py", line 112, in run
status = dispatch(req)
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/dispatch.py", line 298, in dispatch
ret = _runcatch(req) or 0
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/dispatch.py", line 472, in _runcatch
return _callcatch(ui, _runcatchfunc)
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/dispatch.py", line 481, in _callcatch
return scmutil.callcatch(ui, func)
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/scmutil.py", line 152, in callcatch
return func()
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/dispatch.py", line 462, in _runcatchfunc
return _dispatch(req)
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/dispatch.py", line 1226, in _dispatch
lui, repo, cmd, fullargs, ui, options, d, cmdpats, cmdoptions
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/dispatch.py", line 910, in runcommand
ret = _runcommand(ui, options, cmd, d)
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/dispatch.py", line 1237, in _runcommand
return cmdfunc()
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/dispatch.py", line 1223, in <lambda>
d = lambda: util.checksignature(func)(ui, *args, **strcmdopt)
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/util.py", line 1864, in check
return func(*args, **kwargs)
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/commands.py", line 4373, in incoming
return hg.incoming(ui, repo, source, opts)
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/hg.py", line 1240, in incoming
return _incoming(display, subreporecurse, ui, repo, source, opts)
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/hg.py", line 1198, in _incoming
ui, repo, other, revs, opts[b"bundle"], opts[b"force"]
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/bundlerepo.py", line 549, in getremotechanges
tmp = discovery.findcommonincoming(repo, peer, heads=onlyheads, force=force)
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/discovery.py", line 67, in findcommonincoming
ancestorsof=ancestorsof,
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/setdiscovery.py", line 374, in findcommonheads
b'known', {b'nodes': [clnode(r) for r in sample],}
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/wireprotov1peer.py", line 141, in __exit__
self.close()
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/wireprotov1peer.py", line 301, in close
self._responsef.result()
File "/usr/lib/python3.6/concurrent/futures/_base.py", line 432, in result
return self.__get_result()
File "/usr/lib/python3.6/concurrent/futures/_base.py", line 384, in __get_result
raise self._exception
File "/usr/lib/python3.6/concurrent/futures/thread.py", line 56, in run
result = self.fn(*self.args, **self.kwargs)
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/wireprotov1peer.py", line 325, in _readbatchresponse
remoteresult = next(wireresults)
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/wireprotov1peer.py", line 580, in _submitbatch
rsp = self._callstream(b"batch", cmds=encodebatchcmds(req))
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/httppeer.py", line 485, in _callstream
resp = sendrequest(self.ui, self._urlopener, req)
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/httppeer.py", line 300, in sendrequest
res = opener.open(req)
File "/usr/lib/python3.6/urllib/request.py", line 532, in open
response = meth(req, response)
File "/usr/lib/python3.6/urllib/request.py", line 642, in http_response
'http', request, response, code, msg, hdrs)
File "/usr/lib/python3.6/urllib/request.py", line 564, in error
result = self._call_chain(*args)
File "/usr/lib/python3.6/urllib/request.py", line 504, in _call_chain
result = func(*args)
File "/usr/lib/python3.6/urllib/request.py", line 1035, in http_error_401
url, req, headers)
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/url.py", line 514, in http_error_auth_reqed
self, auth_header, host, req, headers
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial_keyring.py", line 616, in basic_http_error_auth_reqed
return basic_http_error_auth_reqed.orig(self, authreq, host, req, headers)
File "/usr/lib/python3.6/urllib/request.py", line 988, in http_error_auth_reqed
return self.retry_http_basic_auth(host, req, realm)
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/url.py", line 519, in retry_http_basic_auth
realm, urllibcompat.getfullurl(req)
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial_keyring.py", line 607, in find_user_password
return self._pwd_handler.find_auth(self, realm, authuri, req)
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial_keyring.py", line 424, in find_auth
pwmgr, realm, authuri, skip_caches=after_bad_auth)
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial_keyring.py", line 383, in get_credentials
keyring_pwd = password_store.get_http_password(keyring_url, actual_user)
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial_keyring.py", line 177, in get_http_password
self._format_http_key(url, username))
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial_keyring.py", line 231, in _read_password_from_keyring
err))
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/ui.py", line 1736, in warn
self._writemsg(self._fmsgerr, type=b'warning', *msg, **opts)
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/ui.py", line 1220, in _writemsg
_writemsgwith(self._write, dest, *args, **opts)
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/ui.py", line 2335, in _writemsgwith
write(dest, *args, **opts)
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/ui.py", line 1175, in _write
self._writenobuf(dest, *args, **opts)
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/ui.py", line 1181, in _writenobuf
msg = b''.join(args)
TypeError: sequence item 0: expected a bytes-like object, str found
$ pip3 freeze | grep keyring
keyring==21.2.1
keyrings.alt==3.0
mercurial-keyring==1.3.0