comparison hgext/phabricator.py @ 43282: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 a4da1c3b82ab
children a2ff3aff81d2
comparison
equal deleted inserted replaced
43281:6230c70a1863 43282:47946f08e463
1272 ) 1272 )
1273 if symbol: 1273 if symbol:
1274 yield (b'symbol', symbol, pos) 1274 yield (b'symbol', symbol, pos)
1275 pos += len(symbol) 1275 pos += len(symbol)
1276 else: # special char, ignore space 1276 else: # special char, ignore space
1277 if text[pos] != b' ': 1277 if text[pos : pos + 1] != b' ':
1278 yield (text[pos], None, pos) 1278 yield (text[pos : pos + 1], None, pos)
1279 pos += 1 1279 pos += 1
1280 yield (b'end', None, pos) 1280 yield (b'end', None, pos)
1281 1281
1282 1282
1283 def _parse(text): 1283 def _parse(text):