diff -r dd67c8c53aea Lib/base64.py --- a/Lib/base64.py Mon Dec 07 02:31:11 2015 +0200 +++ b/Lib/base64.py Wed Dec 23 10:10:11 2015 +0530 @@ -375,10 +375,15 @@ """ b = _bytes_from_decode_data(b) if adobe: - if not (b.startswith(_A85START) and b.endswith(_A85END)): - raise ValueError("Ascii85 encoded byte sequences must be bracketed " - "by {!r} and {!r}".format(_A85START, _A85END)) - b = b[2:-2] # Strip off start/end markers + if not b.endswith(_A85END): + raise ValueError( + "Ascii85 encoded byte sequences must end " + "with {!r}".format(_A85END) + ) + if b.startswith(_A85START): + b = b[2:-2] # Strip off start/end markers + else: + b = b[:-2] # # We have to go through this stepwise, so as to ignore spaces and handle # special short sequences diff -r dd67c8c53aea Lib/test/test_base64.py --- a/Lib/test/test_base64.py Mon Dec 07 02:31:11 2015 +0200 +++ b/Lib/test/test_base64.py Wed Dec 23 10:10:11 2015 +0530 @@ -568,8 +568,6 @@ b"malformed", adobe=True) self.assertRaises(ValueError, base64.a85decode, b"<~still malformed", adobe=True) - self.assertRaises(ValueError, base64.a85decode, - b"also malformed~>", adobe=True) # With adobe=False (the default), Adobe framing markers are disallowed self.assertRaises(ValueError, base64.a85decode,