Mercurial > public > mercurial-scm > hg
comparison mercurial/encoding.py @ 39819:fb628c048d64
py3: don't use os.getcwdb() on Windows to avoid DeprecationWarnings
See also ac32685011a3.
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Sun, 23 Sep 2018 22:36:44 -0400 |
parents | 24e493ec2229 |
children | 9e8fcd2e78c1 |
comparison
equal
deleted
inserted
replaced
39818:24e493ec2229 | 39819:fb628c048d64 |
---|---|
234 for k, v in os.environ.items()) # re-exports | 234 for k, v in os.environ.items()) # re-exports |
235 | 235 |
236 if pycompat.ispy3: | 236 if pycompat.ispy3: |
237 # os.getcwd() on Python 3 returns string, but it has os.getcwdb() which | 237 # os.getcwd() on Python 3 returns string, but it has os.getcwdb() which |
238 # returns bytes. | 238 # returns bytes. |
239 getcwd = os.getcwdb # re-exports | 239 if pycompat.iswindows: |
240 # Python 3 on Windows issues a DeprecationWarning about using the bytes | |
241 # API when os.getcwdb() is called. | |
242 getcwd = lambda: strtolocal(os.getcwd()) # re-exports | |
243 else: | |
244 getcwd = os.getcwdb # re-exports | |
240 else: | 245 else: |
241 getcwd = os.getcwd # re-exports | 246 getcwd = os.getcwd # re-exports |
242 | 247 |
243 # How to treat ambiguous-width characters. Set to 'wide' to treat as wide. | 248 # How to treat ambiguous-width characters. Set to 'wide' to treat as wide. |
244 _wide = _sysstr(environ.get("HGENCODINGAMBIGUOUS", "narrow") == "wide" | 249 _wide = _sysstr(environ.get("HGENCODINGAMBIGUOUS", "narrow") == "wide" |