jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1156367?usp=email )
Change subject: IMPR: Simplify CTEBinaryBytesGenerator ...................................................................... IMPR: Simplify CTEBinaryBytesGenerator - cpython issue 63203 is solved/closed - overwrite _handle_text - assign new _handle_text to _writeBody - remove mangle_from option from CTEBinaryBytesGenerator that policy behaviour is used Change-Id: I6b42d9534c527f84a291e1eea00d87b927fd95fc --- M pywikibot/data/api/__init__.py 1 file changed, 4 insertions(+), 8 deletions(-) Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified diff --git a/pywikibot/data/api/__init__.py b/pywikibot/data/api/__init__.py index c460530..0af2e3e 100644 --- a/pywikibot/data/api/__init__.py +++ b/pywikibot/data/api/__init__.py @@ -61,7 +61,6 @@ # Bug: T113120, T228841 # Subclassing necessary to fix bug of the email package in Python 3: -# see https://github.com/python/cpython/issues/63203 # see https://github.com/python/cpython/issues/63086 # The following solution might be removed if the bug is fixed for # Python versions which are supported by PWB @@ -70,17 +69,14 @@ """Workaround for bug in python 3 email handling of CTE binary.""" - def __init__(self, *args, **kwargs) -> None: - """Initializer.""" - super().__init__(*args, **kwargs) - self._writeBody = self._write_body - - def _write_body(self, msg) -> None: + def _handle_text(self, msg) -> None: if msg['content-transfer-encoding'] == 'binary': self._fp.write(msg.get_payload(decode=True)) else: super()._handle_text(msg) + _writeBody = _handle_text # noqa: N815 + class CTEBinaryMIMEMultipart(MIMEMultipartOrig): @@ -90,7 +86,7 @@ """Return unmodified binary payload.""" policy = self.policy if policy is None else policy fp = BytesIO() - g = CTEBinaryBytesGenerator(fp, mangle_from_=False, policy=policy) + g = CTEBinaryBytesGenerator(fp, policy=policy) g.flatten(self, unixfrom=unixfrom) return fp.getvalue() -- To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1156367?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings?usp=email Gerrit-MessageType: merged Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Change-Id: I6b42d9534c527f84a291e1eea00d87b927fd95fc Gerrit-Change-Number: 1156367 Gerrit-PatchSet: 1 Gerrit-Owner: Xqt <[email protected]> Gerrit-Reviewer: Xqt <[email protected]> Gerrit-Reviewer: jenkins-bot
_______________________________________________ Pywikibot-commits mailing list -- [email protected] To unsubscribe send an email to [email protected]
