D2154: py3: use system strings when calling __import__
indygreg (Gregory Szorc)
phabricator at mercurial-scm.org
Mon Feb 12 02:35:58 UTC 2018
indygreg created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.
REVISION SUMMARY
We must pass the native str type when importing.
REPOSITORY
rHG Mercurial
REVISION DETAIL
https://phab.mercurial-scm.org/D2154
AFFECTED FILES
mercurial/hook.py
CHANGE DETAILS
diff --git a/mercurial/hook.py b/mercurial/hook.py
--- a/mercurial/hook.py
+++ b/mercurial/hook.py
@@ -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:
To: indygreg, #hg-reviewers
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list