I have the contents of a diff file in a bytes object in Python 3. I tried feeding it to PatchSet but it complained:
is_source_filename = RE_SOURCE_FILENAME.match(line)
builtins.TypeError: cannot use a string pattern on a bytes-like object
I had to decode it and now it works, but I'm concerned whether the decoding could fail sometimes if there is binary content. It'll be nice if unidiff would accept the diff in binary form instead of me having to decode.
I have the contents of a diff file in a bytes object in Python 3. I tried feeding it to
PatchSetbut it complained:I had to
decodeit and now it works, but I'm concerned whether the decoding could fail sometimes if there is binary content. It'll be nice if unidiff would accept the diff in binary form instead of me having to decode.