[PATCH 3 of 3] py3: use pycompat.sysstr() in __import__()

Pulkit Goyal 7895pulkit at gmail.com
Sun Dec 4 09:00:52 EST 2016


# HG changeset patch
# User Pulkit Goyal <7895pulkit at gmail.com>
# Date 1480578124 -19800
#      Thu Dec 01 13:12:04 2016 +0530
# Node ID 93275b09d8977ad5700ca56a017f48ce602058ba
# Parent  3743d04e0403e49cd5a9c00d753262162712eeab
py3: use pycompat.sysstr() in __import__()

__import__() on Python 3 accepts strings which are different from that of
Python 2. Used pycompat.sysstr() to get string accordingly.

diff -r 3743d04e0403 -r 93275b09d897 mercurial/extensions.py
--- a/mercurial/extensions.py	Wed Nov 30 23:51:11 2016 +0530
+++ b/mercurial/extensions.py	Thu Dec 01 13:12:04 2016 +0530
@@ -18,6 +18,7 @@
 from . import (
     cmdutil,
     error,
+    pycompat,
     util,
 )
 
@@ -74,7 +75,7 @@
 
 def _importh(name):
     """import and return the <name> module"""
-    mod = __import__(name)
+    mod = __import__(pycompat.sysstr(name))
     components = name.split('.')
     for comp in components[1:]:
         mod = getattr(mod, comp)


More information about the Mercurial-devel mailing list