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.

Title: base64 module still ignores non-alphabet characters
Type: behavior Stage: resolved
Components: Documentation Versions: Python 3.6, Python 3.5, Python 2.7
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: docs@python Nosy List: Julian, docs@python, martin.panter, python-dev, r.david.murray, terry.reedy
Priority: normal Keywords: patch

Created on 2014-07-26 22:44 by Julian, last changed 2022-04-11 14:58 by admin. This issue is now closed.

File name Uploaded Description Edit
base64-discard.patch martin.panter, 2015-12-14 05:44 For 2.7 review
base64-discard.py3.patch martin.panter, 2016-01-07 11:01 review
Messages (6)
msg224089 - (view) Author: Julian Berman (Julian) * Date: 2014-07-26 22:44
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).
msg224525 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2014-08-01 22:45
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?
msg256366 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2015-12-14 05:14
New changeset 937774aa1853 by Martin Panter in branch '2.7':
Issue #22088: Port base64 character ignoring doc and test from 857d9fe60169
msg256368 - (view) Author: Martin Panter (martin.panter) * (Python committer) Date: 2015-12-14 05:44
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.
msg257682 - (view) Author: Martin Panter (martin.panter) * (Python committer) Date: 2016-01-07 11:01
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”
msg260755 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016-02-24 01:19
New changeset c62526580ff0 by Martin Panter in branch '2.7':
Issue #22088: Clarify base-64 alphabets and which characters are discarded

New changeset c8933fbc9171 by Martin Panter in branch '3.5':
Issue #22088: Clarify base-64 alphabets and which characters are discarded

New changeset 5ad27dcd5a97 by Martin Panter in branch 'default':
Issue #22088: Merge base64 docs from 3.5
Date User Action Args
2022-04-11 14:58:06adminsetgithub: 66286
2016-02-24 01:59:58martin.pantersetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2016-02-24 01:19:15python-devsetmessages: + msg260755
2016-01-07 11:01:17martin.pantersetfiles: + base64-discard.py3.patch

messages: + msg257682
2015-12-14 05:44:44martin.pantersetfiles: + base64-discard.patch

versions: + Python 3.5, Python 3.6
keywords: + patch
nosy: + martin.panter

messages: + msg256368
stage: patch review
2015-12-14 05:14:47python-devsetnosy: + python-dev
messages: + msg256366
2014-08-01 22:46:00terry.reedysetnosy: + terry.reedy
messages: + msg224525
components: - Library (Lib)
2014-07-26 22:44:09Juliancreate