Files
RustPython/crates/stdlib
Luan Taraschi b9f591b665 Follow CPython's padding rules in a2b_base64 (#8570)
With strict_mode=True the decoder accepted padding CPython rejects:

    >>> binascii.a2b_base64(b'YWJj=', strict_mode=True)
    b'abc'

It also dropped data in the default mode, because it returned at the
first pad that completed a quad:

    >>> binascii.a2b_base64(b'abc=a')
    b'i\xb7'          # CPython: b'i\xb7\x1a'

The loop now counts pads and decides at the end, the way CPython does,
so a stray pad is ignored outside strict mode and named as leading,
excess or discontinuous inside it. DecodeError::InvalidPadding was dead
in this file and now carries the excess padding message.

test_base64_strict_mode and test_base64_excess_data were marked as
expected failures and pass now.

Assisted-by: Claude Code:claude-opus-5
2026-08-22 12:43:05 +09:00
..
2026-07-07 09:19:25 +09:00
2026-04-21 00:13:25 +09:00