[PATCH 4 of 5 py3] util: reference __main__ in sys.modules as a sysstr

Augie Fackler raf at durin42.com
Mon Mar 20 21:56:50 EDT 2017


# HG changeset patch
# User Augie Fackler <augie at google.com>
# Date 1489900767 14400
#      Sun Mar 19 01:19:27 2017 -0400
# Node ID 6928c4d2776711c0dbf2f37bb9ee7dfbb959b0db
# Parent  70ec92cd06b503cdba456f069c0f65bd71987a6e
util: reference __main__ in sys.modules as a sysstr

diff --git a/mercurial/util.py b/mercurial/util.py
--- a/mercurial/util.py
+++ b/mercurial/util.py
@@ -969,7 +969,7 @@ def hgexecutable():
     """
     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():


More information about the Mercurial-devel mailing list