# HG changeset patch
# User Matt Harbison <matt_harbi...@yahoo.com>
# Date 1537756604 14400
#      Sun Sep 23 22:36:44 2018 -0400
# Node ID bf1934083fa5c3a97492ea112ddb23e8ccf78294
# Parent  1fcff747a558e32f9cb9d8411c256532455c10f8
py3: don't use os.getcwdb() on Windows to avoid DeprecationWarnings

See also ac32685011a3.

diff --git a/mercurial/encoding.py b/mercurial/encoding.py
--- a/mercurial/encoding.py
+++ b/mercurial/encoding.py
@@ -236,7 +236,12 @@ if not _nativeenviron:
 if pycompat.ispy3:
     # os.getcwd() on Python 3 returns string, but it has os.getcwdb() which
     # returns bytes.
-    getcwd = os.getcwdb  # re-exports
+    if pycompat.osname == b'nt':
+        # Python 3 on Windows issues a DeprecationWarning about using the bytes
+        # API when os.getcwdb() is called.
+        getcwd = lambda: strtolocal(os.getcwd())  # re-exports
+    else:
+        getcwd = os.getcwdb  # re-exports
 else:
     getcwd = os.getcwd  # re-exports
 
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to