# HG changeset patch # User Ian Moody # Date 2019-10-17 21:40:24 # Node ID 47946f08e4633dc34c107fd4b7a2b4ae7278f2be # Parent 6230c70a1863de3c20291a5196f011e6a8465740 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 diff --git a/hgext/phabricator.py b/hgext/phabricator.py --- a/hgext/phabricator.py +++ b/hgext/phabricator.py @@ -1274,8 +1274,8 @@ def _tokenize(text): 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)