Re: [PATCH 1 of 3 py3 v3] lock: encode result of gethostname into a bytestring

2017-03-12 Thread Yuya Nishihara
On Sun, 12 Mar 2017 18:42:24 -0400, Augie Fackler wrote:
> # HG changeset patch
> # User Augie Fackler 
> # Date 1489303730 14400
> #  Sun Mar 12 03:28:50 2017 -0400
> # Node ID a8f3bbc6259aebdeeef9f58309800f4070081214
> # Parent  7548522742b5f4f9f5c0881ae4a2783ecda2f969
> lock: encode result of gethostname into a bytestring

Queued, thanks.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 1 of 3 py3 v3] lock: encode result of gethostname into a bytestring

2017-03-12 Thread Augie Fackler
# HG changeset patch
# User Augie Fackler 
# Date 1489303730 14400
#  Sun Mar 12 03:28:50 2017 -0400
# Node ID a8f3bbc6259aebdeeef9f58309800f4070081214
# Parent  7548522742b5f4f9f5c0881ae4a2783ecda2f969
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,8 @@ 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(
+pycompat.sysstr(encoding.encoding), 'replace')
 if pycompat.sysplatform.startswith('linux'):
 try:
 result += '/%x' % os.stat('/proc/self/ns/pid').st_ino
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel