Mercurial > public > mercurial-scm > hg-stable
diff mercurial/cffi/mpatch.py @ 43077:687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Done with
python3.7 contrib/byteify-strings.py -i $(hg files 'set:mercurial/**.py - mercurial/thirdparty/** + hgext/**.py - hgext/fsmonitor/pywatchman/** - mercurial/__init__.py')
black -l 80 -t py33 -S $(hg files 'set:**.py - mercurial/thirdparty/** - "contrib/python-zstandard/**" - hgext/fsmonitor/pywatchman/**')
# skip-blame mass-reformatting only
Differential Revision: https://phab.mercurial-scm.org/D6972
author | Augie Fackler <augie@google.com> |
---|---|
date | Sun, 06 Oct 2019 09:48:39 -0400 |
parents | 2372284d9457 |
children | 521ac0d7047f |
line wrap: on
line diff
--- a/mercurial/cffi/mpatch.py Sun Oct 06 09:45:02 2019 -0400 +++ b/mercurial/cffi/mpatch.py Sun Oct 06 09:48:39 2019 -0400 @@ -18,8 +18,8 @@ @ffi.def_extern() def cffi_get_next_item(arg, pos): all, bins = ffi.from_handle(arg) - container = ffi.new("struct mpatch_flist*[1]") - to_pass = ffi.new("char[]", str(bins[pos])) + container = ffi.new(b"struct mpatch_flist*[1]") + to_pass = ffi.new(b"char[]", str(bins[pos])) all.append(to_pass) r = lib.mpatch_decode(to_pass, len(to_pass) - 1, container) if r < 0: @@ -35,15 +35,15 @@ arg = (all, bins) patch = lib.mpatch_fold(ffi.new_handle(arg), lib.cffi_get_next_item, 0, lgt) if not patch: - raise mpatchError("cannot decode chunk") + raise mpatchError(b"cannot decode chunk") outlen = lib.mpatch_calcsize(len(text), patch) if outlen < 0: lib.mpatch_lfree(patch) - raise mpatchError("inconsistency detected") - buf = ffi.new("char[]", outlen) + raise mpatchError(b"inconsistency detected") + buf = ffi.new(b"char[]", outlen) if lib.mpatch_apply(buf, text, len(text), patch) < 0: lib.mpatch_lfree(patch) - raise mpatchError("error applying patches") + raise mpatchError(b"error applying patches") res = ffi.buffer(buf, outlen)[:] lib.mpatch_lfree(patch) return res