changeset 31384:d57aa655ce97

lock: encode result of gethostname into a bytestring
author Augie Fackler <augie@google.com>
date Sun, 12 Mar 2017 03:28:50 -0400
parents d30fb3de4b40
children 3690c75f4d1e
files mercurial/lock.py
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/lock.py	Sun Mar 12 12:56:12 2017 -0700
+++ b/mercurial/lock.py	Sun Mar 12 03:28:50 2017 -0400
@@ -15,6 +15,7 @@
 import warnings
 
 from . import (
+    encoding,
     error,
     pycompat,
     util,
@@ -27,7 +28,8 @@
     confidence. Typically it's just hostname. On modern linux, we include an
     extra Linux-specific pid namespace identifier.
     """
-    result = socket.gethostname()
+    result = socket.gethostname().encode(
+        pycompat.sysstr(encoding.encoding), 'replace')
     if pycompat.sysplatform.startswith('linux'):
         try:
             result += '/%x' % os.stat('/proc/self/ns/pid').st_ino