changeset 31301:295625f1296b

merge with stable
author Augie Fackler <augie@google.com>
date Sat, 11 Mar 2017 13:53:14 -0500
parents 0c8a042b193d (current diff) 86cd1f2cfff5 (diff)
children 681046de87f1
files mercurial/pycompat.py
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/pycompat.py	Thu Mar 09 20:53:14 2017 -0800
+++ b/mercurial/pycompat.py	Sat Mar 11 13:53:14 2017 -0500
@@ -69,7 +69,8 @@
     #
     # 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 @@
     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