Patchwork [3,of,4,python3] posix: use slicing to grab a single byte out of a bytes in HFS+ normcase code

login
register
mail settings
Submitter Augie Fackler
Date Sept. 16, 2017, 12:34 a.m.
Message ID <8a1f211ac2afb3e49a15.1505522045@augie-macbookpro2.roam.corp.google.com>
Download mbox | patch
Permalink /patch/23933/
State Accepted
Headers show

Comments

Augie Fackler - Sept. 16, 2017, 12:34 a.m.
# HG changeset patch
# User Augie Fackler <raf@durin42.com>
# Date 1505519045 14400
#      Fri Sep 15 19:44:05 2017 -0400
# Node ID 8a1f211ac2afb3e49a15def443b7f556ee3c0d47
# Parent  33c529f19fdf5dbecc7e2853e8eabaac4cc347e2
posix: use slicing to grab a single byte out of a bytes in HFS+ normcase code

Patch

diff --git a/mercurial/posix.py b/mercurial/posix.py
--- a/mercurial/posix.py
+++ b/mercurial/posix.py
@@ -372,7 +372,7 @@  if pycompat.sysplatform == 'darwin':
                     c = encoding.getutf8char(path, pos)
                     pos += len(c)
                 except ValueError:
-                    c = '%%%02X' % ord(path[pos])
+                    c = '%%%02X' % ord(path[pos:pos + 1])
                     pos += 1
                 s += c