[PATCH 3 of 3] py3: simply use b'%d\n' to format pid in server.py

Yuya Nishihara yuya at tcha.org
Thu Jun 1 14:35:47 UTC 2017


# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1496325929 -32400
#      Thu Jun 01 23:05:29 2017 +0900
# Node ID ee0119499321b4b1df8e04694d82f6ca425e60df
# Parent  4bdbaa7eb382e3bff59f05342ac6a5a5fcac42ed
py3: simply use b'%d\n' to format pid in server.py

Spotted by Martin, thanks.

diff --git a/mercurial/server.py b/mercurial/server.py
--- a/mercurial/server.py
+++ b/mercurial/server.py
@@ -33,7 +33,7 @@ def runservice(opts, parentfn=None, init
             else:
                 mode = 'wb'
             fp = open(opts['pid_file'], mode)
-            fp.write(str(pid).encode('latin1') + '\n')
+            fp.write('%d\n' % pid)
             fp.close()
 
     if opts['daemon'] and not opts['daemon_postexec']:



More information about the Mercurial-devel mailing list