Patchwork [2,of,4,V2] py3: slice over bytes to prevent getting ascii values

login
register
mail settings
Submitter Pulkit Goyal
Date May 4, 2017, 10:40 p.m.
Message ID <40e57ce475231ba494c8.1493937616@pulkit-goyal>
Download mbox | patch
Permalink /patch/20437/
State Accepted
Headers show

Comments

Pulkit Goyal - May 4, 2017, 10:40 p.m.
# HG changeset patch
# User Pulkit Goyal <7895pulkit@gmail.com>
# Date 1493927773 -19800
#      Fri May 05 01:26:13 2017 +0530
# Node ID 40e57ce475231ba494c8c0a9cf8f0278411d0c38
# Parent  104a4d6517666d7a10bb371dfdc6c1e83dc670c9
py3: slice over bytes to prevent getting ascii values

Patch

diff -r 104a4d651766 -r 40e57ce47523 mercurial/changelog.py
--- a/mercurial/changelog.py	Sat Apr 08 11:02:37 2017 +0530
+++ b/mercurial/changelog.py	Fri May 05 01:26:13 2017 +0530
@@ -190,7 +190,7 @@ 
 
         # The list of files may be empty. Which means nl3 is the first of the
         # double newline that precedes the description.
-        if text[nl3 + 1] == '\n':
+        if text[nl3 + 1:nl3 + 2] == '\n':
             doublenl = nl3
         else:
             doublenl = text.index('\n\n', nl3 + 1)
diff -r 104a4d651766 -r 40e57ce47523 mercurial/cmdutil.py
--- a/mercurial/cmdutil.py	Sat Apr 08 11:02:37 2017 +0530
+++ b/mercurial/cmdutil.py	Fri May 05 01:26:13 2017 +0530
@@ -491,10 +491,10 @@ 
         patlen = len(pat)
         i = 0
         while i < patlen:
-            c = pat[i]
+            c = pat[i:i + 1]
             if c == '%':
                 i += 1
-                c = pat[i]
+                c = pat[i:i + 1]
                 c = expander[c]()
             newname.append(c)
             i += 1
diff -r 104a4d651766 -r 40e57ce47523 mercurial/util.py
--- a/mercurial/util.py	Sat Apr 08 11:02:37 2017 +0530
+++ b/mercurial/util.py	Fri May 05 01:26:13 2017 +0530
@@ -1980,13 +1980,13 @@ 
             # this piece is for rounding the specific end of unknowns
             b = bias.get(part)
             if b is None:
-                if part[0] in "HMS":
+                if part[0:1] in "HMS":
                     b = "00"
                 else:
                     b = "0"
 
             # this piece is for matching the generic end to today's date
-            n = datestr(now, "%" + part[0])
+            n = datestr(now, "%" + part[0:1])
 
             defaults[part] = (b, n)