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 r.david.murray
Recipients barry, r.david.murray, vunruh, yves@zioup.com
Date 2011-03-12.03:13:34
SpamBayes Score 5.1010585e-11
Marked as misclassified No
Message-id <1299899615.17.0.475573927977.issue9298@psf.upfronthosting.co.za>
In-reply-to
Content
Unfortunately we don't have enough history information to determine who wrote the original _bencode function, although very likely it was Barry.  As for the test, that seems to have been written during the python3 translation to make sure that the behavior implemented by _bencode was preserved.  Python2 has no such test: if you remove the newline check from _bencode, the test suite passes.

Checking with RFC 2045, we find this:

   The encoded output stream must be represented in lines of no more
   than 76 characters each.  All line breaks or other characters not
   found in Table 1 must be ignored by decoding software.  In base64
   data, characters other than those in Table 1, line breaks, and other
   white space probably indicate a transmission error, about which a
   warning message or even a message rejection might be appropriate
   under some circumstances.

"All line breaks..." seems pretty unambiguous: an extra trailing newline should be ignored by any compliant email agent.  That does not eliminate the possibility that a non-compliant email agent would tack on an extra newline if there is one after the base64 encoded text, but it seems very very unlikely.  I am therefore inclined to fix the test, as you suggest.

I hope that Barry can remember why _bencode was introduced in the first place, since clearly there was *some* reason.
History
Date User Action Args
2011-03-12 03:13:35r.david.murraysetrecipients: + r.david.murray, barry, vunruh, yves@zioup.com
2011-03-12 03:13:35r.david.murraysetmessageid: <1299899615.17.0.475573927977.issue9298@psf.upfronthosting.co.za>
2011-03-12 03:13:34r.david.murraylinkissue9298 messages
2011-03-12 03:13:34r.david.murraycreate