Submitter | phabricator |
---|---|
Date | March 9, 2019, 3 a.m. |
Message ID | <differential-rev-PHID-DREV-qrpwrrkm7vqddufilagy-req@phab.mercurial-scm.org> |
Download | mbox | patch |
Permalink | /patch/39156/ |
State | Superseded |
Headers | show |
Comments
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.
yuja added a comment. 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. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D6103 To: Kwan, #hg-reviewers Cc: yuja, mercurial-devel
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
Patch
diff --git a/hgext/phabricator.py b/hgext/phabricator.py --- a/hgext/phabricator.py +++ b/hgext/phabricator.py @@ -671,8 +671,10 @@ pos = 0 length = len(text) while pos < length: - 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:] + ))) if symbol: yield (b'symbol', symbol, pos) pos += len(symbol)