# HG changeset patch # User Gregory Szorc # Date 2018-02-12 00:02:32 # Node ID c4146cf4dd2081856345027c98c36b6610f3ce6a # Parent bff95b002e33652a3b69f3fb7319ce7df5d75b30 py3: use system strings when calling __import__ We must pass the native str type when importing. Differential Revision: https://phab.mercurial-scm.org/D2154 diff --git a/mercurial/hook.py b/mercurial/hook.py --- a/mercurial/hook.py +++ b/mercurial/hook.py @@ -49,12 +49,12 @@ def _pythonhook(ui, repo, htype, hname, modname = modfile with demandimport.deactivated(): try: - obj = __import__(modname) + obj = __import__(pycompat.sysstr(modname)) except (ImportError, SyntaxError): e1 = sys.exc_info() try: # extensions are loaded with hgext_ prefix - obj = __import__("hgext_%s" % modname) + obj = __import__(r"hgext_%s" % pycompat.sysstr(modname)) except (ImportError, SyntaxError): e2 = sys.exc_info() if ui.tracebackflag: