Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions Doc/library/base64.rst
Original file line number Diff line number Diff line change
Expand Up @@ -246,8 +246,7 @@ Refer to the documentation of the individual functions for more information.
*adobe* controls whether the input sequence is in Adobe Ascii85 format
(i.e. is framed with <~ and ~>).

*ignorechars* should be a :term:`bytes-like object` or ASCII string
containing characters to ignore
*ignorechars* should be a byte string containing characters to ignore
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As noted on the issue, I think bytes-like object is correct here.

from the input. This should only contain whitespace characters, and by
default contains all whitespace characters in ASCII.

Expand Down
13 changes: 13 additions & 0 deletions Lib/test/test_base64.py
Original file line number Diff line number Diff line change
Expand Up @@ -948,6 +948,19 @@ def test_a85decode_errors(self):
self.assertRaises(ValueError, base64.a85decode, b'aaaay',
foldspaces=True)

self.assertEqual(base64.a85decode(b"a b\nc", ignorechars=b" \n"),
b'\xc9\x89')
with self.assertRaises(ValueError):
base64.a85decode(b"a b\nc", ignorechars=b"")
with self.assertRaises(ValueError):
base64.a85decode(b"a b\nc", ignorechars=b" ")
with self.assertRaises(ValueError):
base64.a85decode(b"a b\nc", ignorechars=b"\n")
with self.assertRaises(TypeError):
base64.a85decode(b"a b\nc", ignorechars=" \n")
with self.assertRaises(TypeError):
base64.a85decode(b"a b\nc", ignorechars=None)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could also add passing tests for bytearray, array.array, and memoryview here for the ignorechars argument if we want to be complete?


def test_b85decode_errors(self):
illegal = list(range(33)) + \
list(b'"\',./:[\\]') + \
Expand Down
Loading