Patchwork [6,of,8] py3: use bytes[n:n + 1] to get bytes in templater._parsetemplate()

login
register
mail settings
Submitter Yuya Nishihara
Date Sept. 3, 2017, 2:36 p.m.
Message ID <6f837717bec80a273aa7.1504449384@mimosa>
Download mbox | patch
Permalink /patch/23645/
State Accepted
Headers show

Comments

Yuya Nishihara - Sept. 3, 2017, 2:36 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1504427837 -32400
#      Sun Sep 03 17:37:17 2017 +0900
# Node ID 6f837717bec80a273aa7263d1d2af0f68ff04237
# Parent  59a3de8a667ca07200449a64a4716ccbd7c54a93
py3: use bytes[n:n + 1] to get bytes in templater._parsetemplate()

Patch

diff --git a/mercurial/templater.py b/mercurial/templater.py
--- a/mercurial/templater.py
+++ b/mercurial/templater.py
@@ -169,7 +169,7 @@  def _parsetemplate(tmpl, start, stop, qu
             parsed.append(('string', parser.unescapestr(tmpl[pos:stop])))
             pos = stop
             break
-        c = tmpl[n]
+        c = tmpl[n:n + 1]
         bs = (n - pos) - len(tmpl[pos:n].rstrip('\\'))
         if bs % 2 == 1:
             # escaped (e.g. '\{', '\\\{', but not '\\{')