Author r.david.murray
Recipients barry, kitterma, python-dev, r.david.murray
Date 2011-04-10.20:12:30
SpamBayes Score 3.10085e-13
Marked as misclassified No
Message-id <1302466353.71.0.726298472772.issue11492@psf.upfronthosting.co.za>
In-reply-to
Content
This was quite the adventure.  The more I worked on fixing the tests, the more if/else cases the existing splitting algorithm grew.  When I reached the point where fixing one test broke two others, I thought maybe it was time to try a different approach.

Based on the knowledge gathered by banging my head on the old algorithm, I developed a new one.  This one is more RFC2822/RFC5322 compliant, I believe.  It breaks only at FWS, but still gives preference to breaking after commas or semicolons by default.

I had to adjust several tests that tested broken behavior: the "folded" lines were longer than maxlen even though there were suitable fold points.

I'm very happy with this patch because there are 70 fewer lines of code but the module passes more tests.

Even though the code changes are extensive, I plan to apply this to 3.2.  It fixes bugs, and the new code is at least somewhat easier to understand than the old code (if only because there is less of it!)  I don't plan to apply it to 3.1 because one older test fails if the patch is applied and I don't understand why (it appears to have nothing to do with line wrapping, and the same test works fine in 3.2).
History
Date User Action Args
2011-04-10 20:12:34r.david.murraysetrecipients: + r.david.murray, barry, kitterma, python-dev
2011-04-10 20:12:33r.david.murraysetmessageid: <1302466353.71.0.726298472772.issue11492@psf.upfronthosting.co.za>
2011-04-10 20:12:32r.david.murraylinkissue11492 messages
2011-04-10 20:12:32r.david.murraycreate