D6103: py3: use pycompat.iterbytestr to convert itertools.takewhile result back to bytes

Yuya Nishihara yuya at tcha.org
Sat Mar 9 20:23:46 EST 2019


Queued most of the patches in this series, thanks.

> -        symbol = b''.join(itertools.takewhile(lambda ch: ch not in special,
> -                                              view[pos:]))
> +        symbol = b''.join(pycompat.iterbytestr(itertools.takewhile(
> +            lambda ch: ch not in special,
> +            view[pos:]

It's probably better to apply `iterbytestr()` to `view[pos:]` so `ch` is
always a byte string.


More information about the Mercurial-devel mailing list