[issue22088] base64 module still ignores non-alphabet characters
New submission from Julian Berman: The base64 module documentation claims that decode methods raise exceptions for non-base64 input, but they do not. There was a patch for Py3 done in issue1466065, but the documentation was not updated for Py2. I have not read that ticket carefully enough to be able to tell what the expected resolution was for Py2 (fixing the bug or just updating the docs). ---------- assignee: docs@python components: Documentation, Library (Lib) messages: 224089 nosy: Julian, docs@python, r.david.murray priority: normal severity: normal status: open title: base64 module still ignores non-alphabet characters type: behavior versions: Python 2.7 _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue22088> _______________________________________
Terry J. Reedy added the comment: Update the doc. I believe Davis intentionally only applied the 3.2 patch, treating the change as a bit of an enhancement. Can you propose a new wording? ---------- components: -Library (Lib) nosy: +terry.reedy _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue22088> _______________________________________
Roundup Robot added the comment: New changeset 937774aa1853 by Martin Panter in branch '2.7': Issue #22088: Port base64 character ignoring doc and test from 857d9fe60169 https://hg.python.org/cpython/rev/937774aa1853 ---------- nosy: +python-dev _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue22088> _______________________________________
Martin Panter added the comment: While porting the Python 3 changes over, I noticed some related problems in the Python 2 and 3 documentation: * Due to the internal alphabet translation, characters that are in the original base-64 alphabet (+ and /) are not discarded, even if an alternative alphabet is specified * Doc strings of standard_ and urlsafe_b64decode() need fixing as well * Found some copy-paste errors in the doc strings * There are only two distinct base-64 alphabets defined by the RFCs, not three. The URL-safe alphabet and the filename-safe alphabet are the same thing. Here is a patch for review. I will hold off on this until Issue 1753718 has been sorted out to avoid conflicts in the Python 3 docs. ---------- keywords: +patch nosy: +martin.panter stage: -> patch review versions: +Python 3.5, Python 3.6 Added file: http://bugs.python.org/file41301/base64-discard.patch _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue22088> _______________________________________
Martin Panter added the comment: This new patch applies to Python 3. As well as the above changes, I updated the doc strings based on the changes in 92760d2edc9e (Issue 1753718, Issue 20782), mainly clarifying the data types functions accept and return. Further fixes: * In Python 3, b16decode() raises binascii.Error, not TypeError * The base-85 functions’ data parameter is called “b”, not “s” ---------- Added file: http://bugs.python.org/file41522/base64-discard.py3.patch _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue22088> _______________________________________
Roundup Robot added the comment: New changeset c62526580ff0 by Martin Panter in branch '2.7': Issue #22088: Clarify base-64 alphabets and which characters are discarded https://hg.python.org/cpython/rev/c62526580ff0 New changeset c8933fbc9171 by Martin Panter in branch '3.5': Issue #22088: Clarify base-64 alphabets and which characters are discarded https://hg.python.org/cpython/rev/c8933fbc9171 New changeset 5ad27dcd5a97 by Martin Panter in branch 'default': Issue #22088: Merge base64 docs from 3.5 https://hg.python.org/cpython/rev/5ad27dcd5a97 ---------- _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue22088> _______________________________________
Changes by Martin Panter <vadmium+py@gmail.com>: ---------- resolution: -> fixed stage: patch review -> resolved status: open -> closed _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue22088> _______________________________________
participants (4)
-
Julian Berman
-
Martin Panter
-
Roundup Robot
-
Terry J. Reedy