--- ./usr/lib/python3/dist-packages/breezy/plugins/email/emailer.py 2023-05-23 15:06:33.000000000 -0500 +++ /usr/lib/python3/dist-packages/breezy/plugins/email/emailer.py 2023-08-09 22:36:24.667425941 -0500 @@ -128,11 +128,11 @@ # We can use a StringIO because show_diff_trees should only write # 8-bit strings. It is an error to write a Unicode string here. - from io import StringIO - diff_content = StringIO() + from io import BytesIO + diff_content = BytesIO() diff_options = self.config.get('post_commit_diffoptions') show_diff_trees(tree_old, tree_new, diff_content, None, diff_options) - numlines = diff_content.getvalue().count('\n') + 1 + numlines = diff_content.getvalue().count(b'\n') + 1 if numlines <= difflimit: return diff_content.getvalue() else: @@ -235,7 +235,7 @@ msg.add_inline_attachment(diff, self.diff_filename()) # Add revision_mail_headers to the headers - if header is None: + if header is not None: for k, v in header.items(): msg[k] = v