D6103: py3: use pycompat.iterbytestr to convert memoryview slice to bytestring before passing to itertools.takewhile

Kwan (Ian Moody) phabricator at mercurial-scm.org
Thu Mar 14 11:41:07 EDT 2019


Kwan added a comment.


  In https://phab.mercurial-scm.org/D6103#88988, @yuja wrote:
  
  > 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.
  
  
  Thanks, done!

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D6103

To: Kwan, #hg-reviewers
Cc: yuja, mercurial-devel


More information about the Mercurial-devel mailing list