Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Incorrect documentation for ignorechars in base64.a85decode() #144027

Copy link
Copy link
@serhiy-storchaka

Description

@serhiy-storchaka
Issue body actions

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

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.13bugs and security fixesbugs and security fixes3.14bugs and security fixesbugs and security fixes3.15pre-release feature fixes, bugs and security fixespre-release feature fixes, bugs and security fixesdocsDocumentation in the Doc dirDocumentation in the Doc dir
    No fields configured for issues without a type.

    Projects

    Status
    Todo
    Show more project fields

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.