diff mercurial/lock.py @ 35897:4b1c04082cdc

py3: replace "if ispy3" by encoding.strtolocal()
author Yuya Nishihara <yuya@tcha.org>
date Sat, 27 Jan 2018 13:09:49 +0900
parents 9153871d50e0
children c303eda316be
line wrap: on
line diff
--- a/mercurial/lock.py	Sat Feb 03 00:01:57 2018 -0500
+++ b/mercurial/lock.py	Sat Jan 27 13:09:49 2018 +0900
@@ -30,9 +30,7 @@
     confidence. Typically it's just hostname. On modern linux, we include an
     extra Linux-specific pid namespace identifier.
     """
-    result = socket.gethostname()
-    if pycompat.ispy3:
-        result = result.encode(pycompat.sysstr(encoding.encoding), 'replace')
+    result = encoding.strtolocal(socket.gethostname())
     if pycompat.sysplatform.startswith('linux'):
         try:
             result += '/%x' % os.stat('/proc/self/ns/pid').st_ino