Commit Graph
24 Commits
Author SHA1 Message Date
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
Kwak Byoung Min a0f4f6a001 Reject empty UU input before decoding (#8389)
Constraint: Match CPython's a2b_uu empty-input behavior.
Confidence: high
Scope-risk: narrow
Directive: Preserve decoding behavior for non-empty UU buffers.
Tested: prek run --all-files; test_binascii; cargo fmt --check; cargo clippy -p rustpython-stdlib -- -D warnings; cargo test -p rustpython-stdlib; manual full-suite verification
Assisted-by: Codex:gpt-5.6-sol
2026-07-27 21:43:15 +09:00
Shahar Naveh 6eae1dde6c Update some tests to 3.14.5 (#7991) 2026-06-02 18:00:54 +09:00
Shahar Naveh 3667a9a4a4 Update test_binascii.py to 3.14.4 (#7753)
* Update `test_binascii.py` to 3.14.4

* Mark failing test
2026-05-01 12:18:19 +00:00
ShaharNaveh 54450d8ba4 Update test_binascii.py 2026-02-14 18:27:31 +02:00
Jeong, YunWon c9ba9560b5 new_buffer_error (#6243) 2025-11-10 20:58:08 +09:00
ShaharNaveh fa3ecba7a5 Update test_binascii 2025-08-23 21:53:29 +03:00
Jeong, YunWon 0728da51fc binascii.hexlify (#5820) 2025-06-23 08:59:36 +09:00
kingiler bdf228eb42 Fix bug in binascii uu encoding. Pass more related unit tests. (#5160)
* Fix bug in binascii, passes more unit tests.

* Pass more additional tests due to this PR.
2024-02-09 22:42:39 +09:00
Evan Rittenhouse 362be9f344 Add 'invalid base64-encoded string' error 2023-03-04 16:11:02 +09:00
Evan Rittenhouse 904e3a3492 Remove expected failure from test_base64invalid 2023-03-04 16:11:02 +09:00
Evan Rittenhouse 404c398b59 Implement strict_mode keyword for binascii.a2b_base64 2023-03-04 16:11:01 +09:00
Moreal dc9e958bb3 Unmark fixed tests on test_binascii 2022-12-28 05:26:12 +09:00
Moreal 04537b1993 Mark failed tests on test_binascii yet 2022-12-28 05:25:23 +09:00
Moreal 9e9c409644 Update test_binascii.py to CPython 3.11 2022-12-28 05:22:06 +09:00
Jeong YunWon 8dad7add5b Merge pull request #3816 from chang-57/binascii_qp
Add `binascii` `a2b_qp`
2022-08-07 06:22:21 +09:00
Lee Dogeon 02e05e489d Correct binascii.unhexlify error type (#4005)
* Correct `binascii.unhexlify` error type

* Unmark resolved tests
2022-08-07 06:21:35 +09:00
Jeong YunWon a02558b63a fix bug and styles not fixed yet 2022-08-07 05:57:21 +09:00
yangbeom 00cb5ca558 add fn Binascii rlecode_hqx rledecode_hqx (#3809) 2022-06-23 23:22:16 +09:00
yangbeom 4411ac9e17 add binascii.crc_hqx test 2022-06-14 00:51:46 +09:00
Jeong YunWon 4a544a3ca6 Unmark successful tests 2021-10-07 23:28:25 +09:00
Padraic Fanning 165ea9415f Unmark passing test(s) in test_binascii 2021-09-10 18:58:00 -04:00
Padraic Fanning ed1a57f38d Mark erroring/failing tests 2021-02-15 14:23:25 -05:00
Padraic Fanning 56ca19c526 Add test_binascii from CPython 3.8.7 2021-02-15 13:41:50 -05:00