[issue32491] base64.decode: linebreaks are not ignored

2018-01-03 Thread Martin Panter
Martin Panter added the comment: I wrote an incremental base-64 decoder for the "codecs" module in Issue 27799, which you could use. It just does some preprocessing using a regular expression to pick four-character chunks before passing the data to a2b_base64. Or maybe

[issue32491] base64.decode: linebreaks are not ignored

2018-01-03 Thread R. David Murray
R. David Murray added the comment: This reduces to the following: >>> from binascii import a2b_base64 as f >>> f(b'MTIzND\nU2Nzg5\n') b'123456789' >>> f(b'MTIzND\n') Traceback (most recent call last): File "", line 1, in binascii.Error: Incorrect padding That is,

[issue32491] base64.decode: linebreaks are not ignored

2018-01-03 Thread Gregory P. Smith
New submission from Gregory P. Smith : I've tried reading various RFCs around Base64 encoding, but I couldn't make the ends meet. Yet there is an inconsistency between base64.decodebytes() and base64.decode() in that how they handle linebreaks that were used to collate the