[PATCH 09 of 12 py3] lock: encode result of gethostname into a bytestring
Augie Fackler
raf at durin42.com
Sun Mar 12 15:49:58 EDT 2017
# HG changeset patch
# User Augie Fackler <augie at google.com>
# Date 1489303730 14400
# Sun Mar 12 03:28:50 2017 -0400
# Node ID 600b4b0de4f01e4cdafb538805cb46e933b8c2a9
# Parent 19f6f41baa5ef326d3cc953093c5d7ff5dcc4427
lock: encode result of gethostname into a bytestring
diff --git a/mercurial/lock.py b/mercurial/lock.py
--- a/mercurial/lock.py
+++ b/mercurial/lock.py
@@ -15,6 +15,7 @@ import time
import warnings
from . import (
+ encoding,
error,
pycompat,
util,
@@ -27,7 +28,7 @@ def _getlockprefix():
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(encoding.encoding, 'replace')
if pycompat.sysplatform.startswith('linux'):
try:
result += '/%x' % os.stat('/proc/self/ns/pid').st_ino
More information about the Mercurial-devel
mailing list