Page MenuHomePhabricator

email.generator.BytesGenerator on Python 3 corrupts data by changing line endings
Closed, ResolvedPublic

Description

Python 3 email module does not correctly handle the Content-Transfer-Encoding of binary.

7f1c8339c implemented a workaround class CTEBinaryMIMEMultipart to strictly emit the payload unmodified.

The Upstream Python issue 19003 is not yet solved.
It would be good to push for the fix to be included in Python 3.5, so we can use version detection to control whether we use our workaround.

Event Timeline

jayvdb raised the priority of this task from to Medium.
jayvdb updated the task description. (Show Details)
jayvdb added projects: Pywikibot, Upstream.
jayvdb subscribed.

Change 239560 had a related patch set uploaded (by John Vandenberg):
Move CTEBinaryBytesGenerator to new tools module

https://gerrit.wikimedia.org/r/239560

Another area worth exploring is whether future 's MIMEMultipart is has the same bug, or is suitable for our needs.

Upstream issue now resolved in py3.5 and 3.6:

2016-09-11 21:27:22	r.david.murray	set	status: open -> closed
versions: + Python 3.5, Python 3.6, - Python 3.2, Python 3.3, Python 3.4
messages: + msg275859

resolution: fixed
stage: resolved
Xqt lowered the priority of this task from Medium to Lowest.Jun 21 2019, 4:40 AM

Change 518192 had a related patch set uploaded (by Xqt; owner: Xqt):
[pywikibot/core@master] [bugfix] T113120 is solved for Python 3.5+

https://gerrit.wikimedia.org/r/518192

Change 239560 abandoned by Xqt:
Move CTEBinaryBytesGenerator to new tools module

Reason:
In favour of https://gerrit.wikimedia.org/r/#/c/pywikibot/core/ /518192/
Will be removed in PWB 4.0 probably.

https://gerrit.wikimedia.org/r/239560

Change 518192 merged by jenkins-bot:
[pywikibot/core@master] [bugfix] T113120 is solved for Python 3.5+

https://gerrit.wikimedia.org/r/518192

Change 525285 had a related patch set uploaded (by Xqt; owner: Xqt):
[pywikibot/core@master] Revert "[bugfix] T113120 is solved for Python 3.5+"

https://gerrit.wikimedia.org/r/525285

Change 525285 merged by jenkins-bot:
[pywikibot/core@master] Revert "[bugfix] T113120 is solved for Python 3.5+"

https://gerrit.wikimedia.org/r/525285