Patchwork [10,of,10] py3: fix string slicing in util.parsetimezone()

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

Comments

Yuya Nishihara - March 2, 2018, 12:26 a.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1519946158 18000
#      Thu Mar 01 18:15:58 2018 -0500
# Node ID 92dac7bbce17a875c89b9589d1adc14e48e7440e
# Parent  a7eb4c25e04e5be83918ed160dfff78e782165c1
py3: fix string slicing in util.parsetimezone()

Patch

diff --git a/mercurial/util.py b/mercurial/util.py
--- a/mercurial/util.py
+++ b/mercurial/util.py
@@ -2353,6 +2353,7 @@  def shortdate(date=None):
 def parsetimezone(s):
     """find a trailing timezone, if any, in string, and return a
        (offset, remainder) pair"""
+    s = pycompat.bytestr(s)
 
     if s.endswith("GMT") or s.endswith("UTC"):
         return 0, s[:-3].rstrip()