changeset 44069:47946f08e463

py3: don't index into bytes in phabricator's _tokenize() `phabread`ing a stack using `hg phabread :D1234` under py3 will currently die with a KeyError because it will index into `b':D1234'` and return `58` instead of `b':'` as a token. Differential Revision: https://phab.mercurial-scm.org/D7129
author Ian Moody <moz-ian@perix.co.uk>
date Thu, 17 Oct 2019 22:40:24 +0100
parents 6230c70a1863
children 96eb9ef777a8
files hgext/phabricator.py
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/phabricator.py
+++ b/hgext/phabricator.py
@@ -1274,8 +1274,8 @@
             yield (b'symbol', symbol, pos)
             pos += len(symbol)
         else:  # special char, ignore space
-            if text[pos] != b' ':
-                yield (text[pos], None, pos)
+            if text[pos : pos + 1] != b' ':
+                yield (text[pos : pos + 1], None, pos)
             pos += 1
     yield (b'end', None, pos)