Mercurial > hg-stable
changeset 38144:bacbe829c2bf
py3: use bytes in tests/printenv.py
This patch add b'' prefixes and adds some .encode() calls to convert str to
bytes on Python 3.
Differential Revision: https://phab.mercurial-scm.org/D3633
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Sun, 20 May 2018 17:39:09 +0530 |
parents | b0144fc8b681 |
children | d7cecea0b254 |
files | tests/printenv.py |
diffstat | 1 files changed, 5 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/tests/printenv.py Sun May 20 17:37:07 2018 +0530 +++ b/tests/printenv.py Sun May 20 17:39:09 2018 +0530 @@ -39,14 +39,15 @@ if k.startswith("HG_") and v] env.sort() -out.write("%s hook: " % name) +out.write(b"%s hook: " % name.encode('ascii')) if os.name == 'nt': filter = lambda x: x.replace('\\', '/') else: filter = lambda x: x -vars = ["%s=%s" % (k, filter(v)) for k, v in env] -out.write(" ".join(vars)) -out.write("\n") +vars = [b"%s=%s" % (k.encode('ascii'), filter(v).encode('ascii')) + for k, v in env] +out.write(b" ".join(vars)) +out.write(b"\n") out.close() sys.exit(exitcode)