mercurial/pycompat.py
changeset 31301 295625f1296b
parent 31253 64596338ba10
parent 31277 86cd1f2cfff5
child 31359 73b3bee8febe
--- 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