Patchwork [4,of,5] py3: replace bytes[n] with slicing in checkwinfilename()

login
register
mail settings
Submitter Yuya Nishihara
Date Sept. 27, 2017, 12:34 p.m.
Message ID <b75831c83770a3ce9d9c.1506515681@mimosa>
Download mbox | patch
Permalink /patch/24183/
State Accepted
Headers show

Comments

Yuya Nishihara - Sept. 27, 2017, 12:34 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1506507223 -32400
#      Wed Sep 27 19:13:43 2017 +0900
# Node ID b75831c83770a3ce9d9c84112cec6c6807563db1
# Parent  1f783de54c8cce12807b92f41a670d16fbbad6aa
py3: replace bytes[n] with slicing in checkwinfilename()

Patch

diff --git a/mercurial/util.py b/mercurial/util.py
--- a/mercurial/util.py
+++ b/mercurial/util.py
@@ -1290,7 +1290,7 @@  def checkwinfilename(path):
         if base and base.lower() in _winreservednames:
             return _("filename contains '%s', which is reserved "
                      "on Windows") % base
-        t = n[-1]
+        t = n[-1:]
         if t in '. ' and n not in '..':
             return _("filename ends with '%s', which is not allowed "
                      "on Windows") % t