mercurial/pycompat.py
changeset 30334 19d8e19fde5b
parent 30330 a2f2f694dce9
child 30472 277f4fe6d01a
equal deleted inserted replaced
30333:776a6d29b2cc 30334:19d8e19fde5b
    41     fsdecode = os.fsdecode
    41     fsdecode = os.fsdecode
    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 
       
    47     # 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.
       
    49     #
       
    50     # https://hg.python.org/cpython/file/v3.5.1/Programs/python.c#l55
       
    51     #
       
    52     # TODO: On Windows, the native argv is wchar_t, so we'll need a different
       
    53     # workaround to simulate the Python 2 (i.e. ANSI Win32 API) behavior.
    46     sysargv = list(map(os.fsencode, sys.argv))
    54     sysargv = list(map(os.fsencode, sys.argv))
    47 
    55 
    48     def sysstr(s):
    56     def sysstr(s):
    49         """Return a keyword str to be passed to Python functions such as
    57         """Return a keyword str to be passed to Python functions such as
    50         getattr() and str.encode()
    58         getattr() and str.encode()