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

login
register
mail settings
Submitter Augie Fackler
Date March 21, 2017, 1:56 a.m.
Message ID <6928c4d2776711c0dbf2.1490061410@augie-macbookair2.roam.corp.google.com>
Download mbox | patch
Permalink /patch/19492/
State Changes Requested
Headers show

Comments

Augie Fackler - March 21, 2017, 1:56 a.m.
# HG changeset patch
# User Augie Fackler <augie@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

Patch

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():