[issue34832] "Short circuiting" in base64's b64decode, decode, decodebytes

2018-09-29 Thread Felipe Rodrigues
Felipe Rodrigues added the comment: For reference in future discussions, Python's base64 module implements RFC 3548 (https://tools.ietf.org/html/rfc3548) whose section 2.3 (https://tools.ietf.org/html/rfc3548#section-2.3) discusses about "Interpretation of non-alphabet characters in encoded

[issue34832] "Short circuiting" in base64's b64decode, decode, decodebytes

2018-09-28 Thread Felipe Rodrigues
Felipe Rodrigues added the comment: Actually, I'm not even sure if it makes sense to decode the 'first valid substring'... IMHO, we should warn the user -- ___ Python tracker ___

[issue34832] "Short circuiting" in base64's b64decode, decode, decodebytes

2018-09-28 Thread Felipe Rodrigues
Felipe Rodrigues added the comment: I am not sure if simply ignoring the non-valid character is the best way to go. Feels like silencing errors. b64decode does accept the 'validate' flag - defaulted to False - that will halt the execution and throw an error. What might be a good idea is to

[issue34832] "Short circuiting" in base64's b64decode, decode, decodebytes

2018-09-28 Thread Michael Harris
New submission from Michael Harris : When given an invalid base64 string that starts with a valid base64 substring, the functions will return the decoded bytes only up to the substring rather then ignoring the non-alphabet character. Examples: >>> base64.b64decode("") b'\x00\x00\x00\x