Patchwork [04,of,10,py3] parser: use %d instead of %s for interpolating error position

login
register
mail settings
Submitter Augie Fackler
Date March 12, 2017, 6:57 p.m.
Message ID <74e974791be1479b80c6.1489345064@augie-macbookair2.roam.corp.google.com>
Download mbox | patch
Permalink /patch/19206/
State Accepted
Headers show

Comments

Augie Fackler - March 12, 2017, 6:57 p.m.
# HG changeset patch
# User Augie Fackler <augie@google.com>
# Date 1489297499 18000
#      Sun Mar 12 00:44:59 2017 -0500
# Node ID 74e974791be1479b80c6fd42923d999b9c2891a2
# Parent  ecf0bd03ed286a87a7cac46594a241b65e130abf
parser: use %d instead of %s for interpolating error position

Error position is an int, so we should use %d instead of %s. Fixes
failures on Python 3.

Patch

diff --git a/mercurial/parser.py b/mercurial/parser.py
--- a/mercurial/parser.py
+++ b/mercurial/parser.py
@@ -265,7 +265,7 @@  def parseerrordetail(inst):
     """Compose error message from specified ParseError object
     """
     if len(inst.args) > 1:
-        return _('at %s: %s') % (inst.args[1], inst.args[0])
+        return _('at %d: %s') % (inst.args[1], inst.args[0])
     else:
         return inst.args[0]