util: reference __main__ in sys.modules as a sysstr
authorAugie Fackler <augie@google.com>
Sun, 19 Mar 2017 01:19:27 -0400
changeset 31533 28f00d07e2ee
parent 31532 713e984bec91
child 31534 2abba5068aa1
util: reference __main__ in sys.modules as a sysstr
mercurial/util.py
--- a/mercurial/util.py	Sun Mar 19 01:38:10 2017 -0400
+++ b/mercurial/util.py	Sun Mar 19 01:19:27 2017 -0400
@@ -969,7 +969,7 @@
     """
     if _hgexecutable is None:
         hg = encoding.environ.get('HG')
-        mainmod = sys.modules['__main__']
+        mainmod = sys.modules[pycompat.sysstr('__main__')]
         if hg:
             _sethgexecutable(hg)
         elif mainfrozen():