merge with stable
authorAugie Fackler <augie@google.com>
Sat, 11 Mar 2017 13:53:14 -0500
changeset 31301 295625f1296b
parent 31300 0c8a042b193d (current diff)
parent 31277 86cd1f2cfff5 (diff)
child 31302 681046de87f1
merge with stable
mercurial/pycompat.py
--- 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