mirror of
https://github.com/facebook/sapling.git
synced 2024-10-10 08:47:12 +03:00
py3: have bytes version of sys.executable
sys.executable on Python 3 returns unicodes and we want bytes. So this patch adds a new pycompat.sysexecutable which returns bytes by encoding using os.fsencode() since it is path variable.
This commit is contained in:
parent
ff574e7b93
commit
5b1c662d4d
@ -52,6 +52,9 @@ if ispy3:
|
||||
# returns bytes.
|
||||
getcwd = os.getcwdb
|
||||
sysplatform = sys.platform.encode('ascii')
|
||||
sysexecutable = sys.executable
|
||||
if sysexecutable:
|
||||
sysexecutable = os.fsencode(sysexecutable)
|
||||
|
||||
# TODO: .buffer might not exist if std streams were replaced; we'll need
|
||||
# a silly wrapper to make a bytes stream backed by a unicode one.
|
||||
@ -158,6 +161,7 @@ else:
|
||||
sysplatform = sys.platform
|
||||
getcwd = os.getcwd
|
||||
osgetenv = os.getenv
|
||||
sysexecutable = sys.executable
|
||||
|
||||
stringio = io.StringIO
|
||||
empty = _queue.Empty
|
||||
|
Loading…
Reference in New Issue
Block a user