mirror of
https://github.com/python/cpython.git
synced 2025-12-15 21:44:50 +00:00
Merge #15249: Mangle From lines correctly when body contains invalid bytes.
Fix by Colin Su. Test by me, based on a test written by Petri Lehtinen.
This commit is contained in:
commit
ad2a7d528a
4 changed files with 21 additions and 1 deletions
|
|
@ -400,6 +400,8 @@ class BytesGenerator(Generator):
|
|||
if msg._payload is None:
|
||||
return
|
||||
if _has_surrogates(msg._payload) and not self.policy.cte_type=='7bit':
|
||||
if self._mangle_from_:
|
||||
msg._payload = fcre.sub(">From ", msg._payload)
|
||||
self.write(msg._payload)
|
||||
else:
|
||||
super(BytesGenerator,self)._handle_text(msg)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue