mercurial/lock.py
changeset 31375 d57aa655ce97
parent 31354 e6a2b625e0d9
child 31378 2e48c776a874
--- 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