mercurial/pycompat.py
changeset 45056 9694895749ad
parent 45018 f2dc337117b9
child 45726 d1072cba8aff
equal deleted inserted replaced
45055:4c1b4805db57 45056:9694895749ad
   139 
   139 
   140     rawinput = input
   140     rawinput = input
   141     getargspec = inspect.getfullargspec
   141     getargspec = inspect.getfullargspec
   142 
   142 
   143     long = int
   143     long = int
   144 
       
   145     # Warning: sys.stdout.buffer and sys.stderr.buffer do not necessarily have
       
   146     # the same buffering behavior as sys.stdout and sys.stderr. The interpreter
       
   147     # initializes them with block-buffered streams or unbuffered streams (when
       
   148     # the -u option or the PYTHONUNBUFFERED environment variable is set), never
       
   149     # with a line-buffered stream.
       
   150     # TODO: .buffer might not exist if std streams were replaced; we'll need
       
   151     # a silly wrapper to make a bytes stream backed by a unicode one.
       
   152     stdin = sys.stdin.buffer
       
   153     stdout = sys.stdout.buffer
       
   154     stderr = sys.stderr.buffer
       
   155 
   144 
   156     if getattr(sys, 'argv', None) is not None:
   145     if getattr(sys, 'argv', None) is not None:
   157         # On POSIX, the char** argv array is converted to Python str using
   146         # On POSIX, the char** argv array is converted to Python str using
   158         # Py_DecodeLocale(). The inverse of this is Py_EncodeLocale(), which
   147         # Py_DecodeLocale(). The inverse of this is Py_EncodeLocale(), which
   159         # isn't directly callable from Python code. In practice, os.fsencode()
   148         # isn't directly callable from Python code. In practice, os.fsencode()
   474     ospardir = os.pardir
   463     ospardir = os.pardir
   475     ossep = os.sep
   464     ossep = os.sep
   476     osaltsep = os.altsep
   465     osaltsep = os.altsep
   477     osdevnull = os.devnull
   466     osdevnull = os.devnull
   478     long = long
   467     long = long
   479     stdin = sys.stdin
       
   480     stdout = sys.stdout
       
   481     stderr = sys.stderr
       
   482     if getattr(sys, 'argv', None) is not None:
   468     if getattr(sys, 'argv', None) is not None:
   483         sysargv = sys.argv
   469         sysargv = sys.argv
   484     sysplatform = sys.platform
   470     sysplatform = sys.platform
   485     sysexecutable = sys.executable
   471     sysexecutable = sys.executable
   486     shlexsplit = shlex.split
   472     shlexsplit = shlex.split