[docs] base64 "legacy" functions violate RFC 3548 (issue 1753718)

rdmurray at bitdance.com rdmurray at bitdance.com
Tue Dec 15 21:08:46 EST 2015


http://bugs.python.org/review/1753718/diff/16149/Doc/library/base64.rst
File Doc/library/base64.rst (right):

http://bugs.python.org/review/1753718/diff/16149/Doc/library/base64.rst#newcode30
Doc/library/base64.rst:30: In addition to the above, the legacy
interface also provides for encoding and
On 2015/12/14 03:39:33, vadmium wrote:
> This is a bit misleading, e.g. the “legacy” interface doesn’t accept
str
> objects.

Ah, good point.  I thought I'd tested that, but obviously I didn't.

http://bugs.python.org/review/1753718/diff/16149/Doc/library/base64.rst#newcode52
Doc/library/base64.rst:52: Optional *altchars* must be a
:term:`bytes-like object` of at least
On 2015/12/14 03:39:33, vadmium wrote:
> Safer to say it must be a bytes object. The code does an assert using
len().

Why is that an issue?  It accepts bytearray and memoryview, so saying
bytes object would be incorrect.

http://bugs.python.org/review/1753718/diff/16149/Doc/library/base64.rst#newcode61
Doc/library/base64.rst:61: Decode the Base64 encoded :term:`bytes-like
object` *s* and return
On 2015/12/14 03:39:33, vadmium wrote:
> or ASCII str

Heh, fixed it in the intro and the forgot in the body.

http://bugs.python.org/review/1753718/diff/16149/Doc/library/base64.rst#newcode64
Doc/library/base64.rst:64: Optional *altchars* must be a
:term:`bytes-like object` of
On 2015/12/14 03:39:33, vadmium wrote:
> The code goes out of its way to also support ASCII character strings

Oh, I tested encode but not decode.

http://bugs.python.org/review/1753718/diff/16149/Doc/library/base64.rst#newcode185
Doc/library/base64.rst:185: *ignorechars* should be a :term:`bytes-like
object` containing characters to ignore
On 2015/12/14 03:39:33, vadmium wrote:
> Safer to just say bytes; the code tests “x in ignorechars”

Again, why is this a problem?

http://bugs.python.org/review/1753718/diff/16149/Doc/library/base64.rst#newcode233
Doc/library/base64.rst:233: Decode the :term:`bytes-like object` *s*,
which must contain one or more lines of base64
On 2015/12/14 03:39:33, vadmium wrote:
> The object must also be a one-dimensional array of bytes (c, b or B
format)

There was a lot of discussion around this when the terms were added to
and then modified in the glossary.  The actual requirement is a C
contiguous buffer (which the glossary defines), and if base64 actually
requires it to be one dimensional then that's a bug, either in the code
or in the glossary.

http://bugs.python.org/review/1753718/


More information about the docs mailing list