changeset 36146:c4146cf4dd20

py3: use system strings when calling __import__ We must pass the native str type when importing. Differential Revision: https://phab.mercurial-scm.org/D2154
author Gregory Szorc <gregory.szorc@gmail.com>
date Sun, 11 Feb 2018 16:02:32 -0800
parents bff95b002e33
children 361276a36d49
files mercurial/hook.py
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/hook.py	Sun Feb 11 15:58:31 2018 -0800
+++ b/mercurial/hook.py	Sun Feb 11 16:02:32 2018 -0800
@@ -49,12 +49,12 @@
                 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: