This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author andrei.avk
Recipients andrei.avk, grant.b.edwards, r.david.murray
Date 2021-11-24.05:58:44
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1637733524.67.0.46940010539.issue45299@roundup.psfhosted.org>
In-reply-to
Content
There are 3 policy settings that are also being passed as parameters to Generator/BytesGenerator:

- mangle_from_
- linesep
- maxheaderlen

Both linesep and maxheaderlen are being inserted into policy after self.policy (if there is one) overrides message policy.

The docs for both linesep and maxheaderlen match the code.

So this only leaves us the buggy `mangle_from_`.

I think it makes sense to fix it in `send_message()` rather than in BytesGenerator because:

- less backwards compatibility breakage
- there's already a workaround for BytesGenerator (provide the parameter)
- there were no reports from users of BytesGenerator

We have two ways to fix it in send_message() --
- provide policy as an arg
- provide mangle_from_ as an arg

I think the 2nd choice is better because it's more direct and easier to understand. If we use msg.policy as an arg, it looks like we're using msg.policy to override msg.policy, which wouldn't make any sense except that mangle_from_ is being set from policy arg rather than msg.policy.

If there's code out there that relies on this bug in send_message(), I would guess it's more likely to be test suites that compare output to version where *from* is mangled.

Docs for BytesGenerator should be fixed to warn about this issue.
History
Date User Action Args
2021-11-24 05:58:44andrei.avksetrecipients: + andrei.avk, r.david.murray, grant.b.edwards
2021-11-24 05:58:44andrei.avksetmessageid: <1637733524.67.0.46940010539.issue45299@roundup.psfhosted.org>
2021-11-24 05:58:44andrei.avklinkissue45299 messages
2021-11-24 05:58:44andrei.avkcreate