diff --git a/Doc/library/base64.rst b/Doc/library/base64.rst index 4876117f6403b2..08e923c0a5244f 100644 --- a/Doc/library/base64.rst +++ b/Doc/library/base64.rst @@ -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 from the input. This should only contain whitespace characters, and by default contains all whitespace characters in ASCII. diff --git a/Lib/test/test_base64.py b/Lib/test/test_base64.py index 120c5824a42a40..24f8836f1b2178 100644 --- a/Lib/test/test_base64.py +++ b/Lib/test/test_base64.py @@ -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) + def test_b85decode_errors(self): illegal = list(range(33)) + \ list(b'"\',./:[\\]') + \