Issue 15249: email.generator.BytesGenerator doesn't mangle "From " lines when non-ASCII bytes are present (original) (raw)

Created on 2012-07-04 10:13 by petri.lehtinen, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
issue115249_test.patch petri.lehtinen,2012-07-05 04:18
issue15249.patch littleq0903,2012-08-23 17:59 Solution review
issue15249_fixed.patch littleq0903,2012-08-23 18:09 the patch without __init__ changes review
Messages (7)
msg164641 - (view) Author: Petri Lehtinen (petri.lehtinen) * (Python committer) Date: 2012-07-04 10:13
The _handle_text function of BytesGenerator writes the payload straight through if there surrogateescape sequences are present, and skips the "From " mangling.
msg164671 - (view) Author: Petri Lehtinen (petri.lehtinen) * (Python committer) Date: 2012-07-05 04:18
Attached a test case that fails.
msg168951 - (view) Author: Colin Su (littleq0903) * Date: 2012-08-23 17:59
when ByteGenerator entered _has_surrogates() will write the payload directly by not-enter into the super class Generator, which has the replace action. my solution is just do it also in BytesGenerator.
msg168953 - (view) Author: Colin Su (littleq0903) * Date: 2012-08-23 18:09
Sorry, forgot removing the debugging __init__ method. the attachment is the patch without the __init__ changes.
msg168961 - (view) Author: Petri Lehtinen (petri.lehtinen) * (Python committer) Date: 2012-08-23 19:31
The patch looks good to me and seems to fix my test case. I find the email code somewhat complicated, so I'll let David decide whether it's the correct fix :)
msg169028 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2012-08-24 15:31
New changeset 119c645f310e by R David Murray in branch '3.2': #15249: Mangle From lines correctly when body contains invalid bytes. http://hg.python.org/cpython/rev/119c645f310e New changeset b6ee4e8c7a77 by R David Murray in branch 'default': Merge #15249: Mangle From lines correctly when body contains invalid bytes. http://hg.python.org/cpython/rev/b6ee4e8c7a77
msg169029 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2012-08-24 15:33
Thanks, LittleQ. And Petri.
History
Date User Action Args
2022-04-11 14:57:32 admin set github: 59454
2012-08-24 15:33:15 r.david.murray set status: open -> closedresolution: fixedmessages: + stage: patch review -> resolved
2012-08-24 15:31:40 python-dev set nosy: + python-devmessages: +
2012-08-23 19:31:59 petri.lehtinen set messages: + stage: needs patch -> patch review
2012-08-23 18:09:06 littleq0903 set files: + issue15249_fixed.patchmessages: +
2012-08-23 17:59:57 littleq0903 set files: + issue15249.patchnosy: + littleq0903messages: +
2012-07-05 04🔞25 petri.lehtinen set files: + issue115249_test.patchkeywords: + patchmessages: +
2012-07-04 10:13:06 petri.lehtinen create