# HG changeset patch # User Augie Fackler # Date 2017-03-11 18:53:14 # Node ID 295625f1296bda9c507b9025177c4f2452408cc3 # Parent 0c8a042b193d9f19a1ba161a861f2647ae8eb80a # Parent 86cd1f2cfff5d5f5ebda227b147ad71a59058323 merge with stable diff --git a/mercurial/pycompat.py b/mercurial/pycompat.py --- a/mercurial/pycompat.py +++ b/mercurial/pycompat.py @@ -69,7 +69,8 @@ if ispy3: # # TODO: On Windows, the native argv is wchar_t, so we'll need a different # workaround to simulate the Python 2 (i.e. ANSI Win32 API) behavior. - sysargv = list(map(os.fsencode, sys.argv)) + if getattr(sys, 'argv', None) is not None: + sysargv = list(map(os.fsencode, sys.argv)) def bytechr(i): return bytes([i]) @@ -173,7 +174,8 @@ else: stdin = sys.stdin stdout = sys.stdout stderr = sys.stderr - sysargv = sys.argv + if getattr(sys, 'argv', None) is not None: + sysargv = sys.argv sysplatform = sys.platform getcwd = os.getcwd sysexecutable = sys.executable