mercurial/pycompat.py
changeset 30472 277f4fe6d01a
parent 30334 19d8e19fde5b
child 30500 fc0cfe6c87d7
equal deleted inserted replaced
30471:00c9ac4ce816 30472:277f4fe6d01a
    42     # A bytes version of os.name.
    42     # A bytes version of os.name.
    43     osname = os.name.encode('ascii')
    43     osname = os.name.encode('ascii')
    44     ospathsep = os.pathsep.encode('ascii')
    44     ospathsep = os.pathsep.encode('ascii')
    45     ossep = os.sep.encode('ascii')
    45     ossep = os.sep.encode('ascii')
    46 
    46 
       
    47     # TODO: .buffer might not exist if std streams were replaced; we'll need
       
    48     # a silly wrapper to make a bytes stream backed by a unicode one.
       
    49     stdin = sys.stdin.buffer
       
    50     stdout = sys.stdout.buffer
       
    51     stderr = sys.stderr.buffer
       
    52 
    47     # Since Python 3 converts argv to wchar_t type by Py_DecodeLocale() on Unix,
    53     # Since Python 3 converts argv to wchar_t type by Py_DecodeLocale() on Unix,
    48     # we can use os.fsencode() to get back bytes argv.
    54     # we can use os.fsencode() to get back bytes argv.
    49     #
    55     #
    50     # https://hg.python.org/cpython/file/v3.5.1/Programs/python.c#l55
    56     # https://hg.python.org/cpython/file/v3.5.1/Programs/python.c#l55
    51     #
    57     #
    98         return filename
   104         return filename
    99 
   105 
   100     osname = os.name
   106     osname = os.name
   101     ospathsep = os.pathsep
   107     ospathsep = os.pathsep
   102     ossep = os.sep
   108     ossep = os.sep
       
   109     stdin = sys.stdin
       
   110     stdout = sys.stdout
       
   111     stderr = sys.stderr
   103     sysargv = sys.argv
   112     sysargv = sys.argv
   104 
   113 
   105 stringio = io.StringIO
   114 stringio = io.StringIO
   106 empty = _queue.Empty
   115 empty = _queue.Empty
   107 queue = _queue.Queue
   116 queue = _queue.Queue