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.

Unsupported provider

classification
Title: Inconsistency between b32decode() documentation, docstring and code
Type: behavior Stage: resolved
Components: Documentation, Library (Lib) Versions: Python 3.3, Python 3.4
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: serhiy.storchaka Nosy List: barry, docs@python, ethan.furman, gvanrossum, python-dev, r.david.murray, serhiy.storchaka
Priority: normal Keywords: patch

Created on 2013-05-19 08:19 by serhiy.storchaka, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
b32decode_exception.patch serhiy.storchaka, 2013-05-19 10:11 review
Messages (8)
msg189571 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2013-05-19 08:19
b32decode() documentation says: "A TypeError is raised if s were incorrectly padded or if there are non-alphabet characters present in the string."

b32decode() docstring says: "binascii.Error is raised if the input is incorrectly padded or if there are non-alphabet characters present in the input."

Actually binascii.Error (which is a ValueError subtype) is raised if the input is incorrectly padded and TypeError is raised if there are non-alphabet characters present in the input.

At least 2 of 3 (documentation, docstring and implementation) should be corrected.

Base32 support was originally added in 3cc0d8fd4e2b (TypeError was used everywhere) and then modified in eb45f85c4c79 (TypeError was partially changed to binascii.Error).
msg189576 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2013-05-19 10:11
Here is a patch which changes TypeError to binascii.Error in b32decode() and fixes the documentation and tests.
msg189901 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2013-05-24 07:35
Are there any objections?
msg190201 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-05-28 12:35
New changeset 0b9bcb2ac145 by Serhiy Storchaka in branch '3.3':
Issue #18011: base64.b32decode() now raises a binascii.Error if there are
http://hg.python.org/cpython/rev/0b9bcb2ac145

New changeset 7446f53ba2d2 by Serhiy Storchaka in branch 'default':
Issue #18011: base64.b32decode() now raises a binascii.Error if there are
http://hg.python.org/cpython/rev/7446f53ba2d2
msg190202 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-05-28 12:43
New changeset 29a823f31465 by Serhiy Storchaka in branch 'default':
Issue #18011: Silence an unrelated noise introduced in changeset 1b5ef05d6ced.
http://hg.python.org/cpython/rev/29a823f31465
msg207708 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2014-01-08 22:51
For future reference, because this patch changed the type of an error, it should not have been applied to a maintenance release (3.3).  Since the change has already been released in 3.3.3, it is now better not to revert it.
msg207710 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2014-01-08 23:00
This is not incompatible change because b32decode() already raised this type of an error. Third-party code which use b32decode() was either incorrect (if it catches only TypeError or binascii.Error when any of them could raised) or is not broken by this change.
msg207711 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2014-01-08 23:02
But code could be catching TypeError specifically looking for the alphabet error, since that is how it was documented.
History
Date User Action Args
2022-04-11 14:57:45adminsetgithub: 62211
2014-01-08 23:02:51r.david.murraysetmessages: + msg207711
2014-01-08 23:00:44serhiy.storchakasetmessages: + msg207710
2014-01-08 22:51:47r.david.murraysetnosy: + r.david.murray
messages: + msg207708
2013-05-28 12:43:15python-devsetmessages: + msg190202
2013-05-28 12:36:41serhiy.storchakasetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2013-05-28 12:35:30python-devsetnosy: + python-dev
messages: + msg190201
2013-05-24 07:35:28serhiy.storchakasetassignee: docs@python -> serhiy.storchaka
messages: + msg189901
2013-05-20 11:47:51ethan.furmansetnosy: + ethan.furman
2013-05-19 10:16:05serhiy.storchakasetfiles: - b32decode_exception.patch
2013-05-19 10:15:54serhiy.storchakasetmessages: - msg189577
2013-05-19 10:14:26serhiy.storchakasetfiles: + b32decode_exception.patch

messages: + msg189577
2013-05-19 10:11:22serhiy.storchakasetfiles: + b32decode_exception.patch
keywords: + patch
messages: + msg189576

stage: patch review
2013-05-19 08:19:09serhiy.storchakacreate