The base64.a85decode() docstring documents the ignorechars parameter as:
ignorechars should be a byte string containing characters to ignore from the
input. This should only contain whitespace characters, and by default
contains all whitespace characters in ASCII.
But the reStructuredText documentation documents it as:
*ignorechars* should be a :term:`bytes-like object` or ASCII string
containing characters to ignore
from the input. This should only contain whitespace characters, and by
default contains all whitespace characters in ASCII.
ASCII string does not work as ignorechars.
>>> import base64
>>> base64.a85decode(b' ', ignorechars=b' ')
b''
>>> base64.a85decode(b' ', ignorechars=' ')
TypeError: 'in <string>' requires string as left operand, not int
The change was introduced in a198645 (bpo-1753718).
Also, the "bytes-like object" term is vague and has different meaning in different places. Usually it means support of the buffer protocol, but in this case the code does not work with arbitrary objects implementing the buffer protocol. So I think it is better to return the old "byte string", as in the docstring.
cc @bitdancer.
Linked PRs
The
base64.a85decode()docstring documents theignorecharsparameter as:But the reStructuredText documentation documents it as:
ASCII string does not work as
ignorechars.The change was introduced in a198645 (bpo-1753718).
Also, the "bytes-like object" term is vague and has different meaning in different places. Usually it means support of the buffer protocol, but in this case the code does not work with arbitrary objects implementing the buffer protocol. So I think it is better to return the old "byte string", as in the docstring.
cc @bitdancer.
Linked PRs