comparison hgext/phabricator.py @ 41950:e7b84ffb06d9

py3: use pycompat.iterbytestr to convert memoryview slice to bytestring Otherwise ch is the int value of the byte in py3 rather than the actual character. Differential Revision: https://phab.mercurial-scm.org/D6103
author Ian Moody <moz-ian@perix.co.uk>
date Sat, 09 Mar 2019 00:44:26 +0000
parents 2b21c7fbb3a1
children 51ba9fbcca52
comparison
equal deleted inserted replaced
41949:e1ceefab9bca 41950:e7b84ffb06d9
673 special = b'():+-& ' 673 special = b'():+-& '
674 pos = 0 674 pos = 0
675 length = len(text) 675 length = len(text)
676 while pos < length: 676 while pos < length:
677 symbol = b''.join(itertools.takewhile(lambda ch: ch not in special, 677 symbol = b''.join(itertools.takewhile(lambda ch: ch not in special,
678 view[pos:])) 678 pycompat.iterbytestr(view[pos:])))
679 if symbol: 679 if symbol:
680 yield (b'symbol', symbol, pos) 680 yield (b'symbol', symbol, pos)
681 pos += len(symbol) 681 pos += len(symbol)
682 else: # special char, ignore space 682 else: # special char, ignore space
683 if text[pos] != b' ': 683 if text[pos] != b' ':