Patchwork [05,of,10] py3: fix type of string literals in templater.tokenize()

login
register
mail settings
Submitter Yuya Nishihara
Date March 2, 2018, 12:26 a.m.
Message ID <3a9920b08348866d5d9f.1519950384@mimosa>
Download mbox | patch
Permalink /patch/28629/
State Accepted
Headers show

Comments

Yuya Nishihara - March 2, 2018, 12:26 a.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1519941398 18000
#      Thu Mar 01 16:56:38 2018 -0500
# Node ID 3a9920b08348866d5d9f2f85b9d332544686b843
# Parent  47a09e779081aed563018208407c771ede557ffd
py3: fix type of string literals in templater.tokenize()

# skip-blame because just b'' prefixes

Patch

diff --git a/mercurial/templater.py b/mercurial/templater.py
--- a/mercurial/templater.py
+++ b/mercurial/templater.py
@@ -98,8 +98,8 @@  def tokenize(program, start, end, term=N
                 pos += 1
             yield ('integer', program[s:pos], s)
             pos -= 1
-        elif (c == '\\' and program[pos:pos + 2] in (r"\'", r'\"')
-              or c == 'r' and program[pos:pos + 3] in (r"r\'", r'r\"')):
+        elif (c == '\\' and program[pos:pos + 2] in (br"\'", br'\"')
+              or c == 'r' and program[pos:pos + 3] in (br"r\'", br'r\"')):
             # handle escaped quoted strings for compatibility with 2.9.2-3.4,
             # where some of nested templates were preprocessed as strings and
             # then compiled. therefore, \"...\" was allowed. (issue4733)