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 Claudiu Saftoiu, CryptidVulpes, r.david.murray
Date 2016-07-29.01:46:38
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1469756800.08.0.804912972331.issue27397@psf.upfronthosting.co.za>
In-reply-to
Content
Thanks for narrowing this down.  There are two problems: the first is that the base64 module is raising "Incorrect padding" when the issue is actually that the input string cannot be decoded using the base64 algorithm no matter what padding might be supplied.  The second is that the else clause in _encoded_words *can* happen, in this circumstance.

The circumstance is that the input string contains n*4+1 characters.  No encoding of source text will ever produce that number of output characters.  (I also seem to have used an index one greater than needed for the loop; the maximum number of padding characters is 2.)

The interesting question is what we want to do for error recovery in the n*4+1 case.  Do we declare the part invalid and return an empty string?  Do we try chopping off the last character and see if we can decode it?  The latter is complicated by the possible presence of invalid alphabet characters, but it is what I lean toward.

I'm open to alternate suggestions.  And to a patch if someone wants to write one :)
History
Date User Action Args
2016-07-29 01:46:40r.david.murraysetrecipients: + r.david.murray, Claudiu Saftoiu, CryptidVulpes
2016-07-29 01:46:40r.david.murraysetmessageid: <1469756800.08.0.804912972331.issue27397@psf.upfronthosting.co.za>
2016-07-29 01:46:40r.david.murraylinkissue27397 messages
2016-07-29 01:46:38r.david.murraycreate