Skip to content

testAllBase64Features_librt fails with Python 3.14.4 #21120

Description

@mr-c

Bug Report

Yes, I know that Python 3.14.4 is not yet released, but the Python3.14 package in Debian's development distribution (sid a.k.a. unstable) is built from the "3.14 branch 2026-03-27."

which includes Do not ignore excess Base64 data after the first padded quad

and thus test

_________________________ testAllBase64Features_librt __________________________
[gw0] linux -- Python 3.14.3 /usr/bin/python3.14
data: /build/reproducible-path/package/mypyc/test-data/run-base64.test:1:
Failed: Invalid output (/build/reproducible-path/package/mypyc/test-data/run-base64.test, line 1)
----------------------------- Captured stdout call -----------------------------

*** Exit status: 1
----------------------------- Captured stderr call -----------------------------

Generated files: /build/reproducible-path/package/.mypyc_test_output (for first failure only)

Expected:
Actual:
  << test_decode_with_extra_data_after_padding >> (diff)
  Traceback (most recent call last): (diff)
    File "driver.py", line 57, in <module> (diff)
      raise failures[-1][1][1] (diff)
    File "driver.py", line 28, in <module> (diff)
      test_func() (diff)
      ~~~~~~~~~^^ (diff)
    File "run-base64.test", line 149, in test_decode_with_extra_data_after_padding (diff)
      check_decode(b"eA==x", encoded=True) (diff)
    File "run-base64.test", line 70, in check_decode (diff)
      assert b64decode(enc) == getattr(base64, "b64decode")(enc) (diff)
    File "/usr/lib/python3.14/base64.py", line 85, in b64decode (diff)
      return binascii.a2b_base64(s, strict_mode=validate) (diff)
             ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^ (diff)
  binascii.Error: Incorrect padding (diff)

Update the test output using --update-data (implies -n0; you can additionally use the -k selector to update only specific tests)
------------------------------ Captured log call -------------------------------
INFO     root:dist.py:1018 running build_ext
INFO     root:build_ext.py:538 building 'native' extension
INFO     root:dir_util.py:58 creating build/temp.linux-x86_64-cpython-314/build
INFO     root:spawn.py:77 x86_64-linux-gnu-gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O2 -Wall -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/build/reproducible-path/package/.pybuild/cpython3_3.14_mypy/build/mypyc/lib-rt -I/usr/include/python3.14 -c build/__native.c -o build/temp.linux-x86_64-cpython-314/build/__native.o -O0 -g1 -Werror -Wno-unused-function -Wno-unused-label -Wno-unreachable-code -Wno-unused-variable -Wno-unused-command-line-argument -Wno-unknown-warning-option -Wno-unused-but-set-variable -Wno-ignored-optimization-argument -Wno-array-bounds -Wno-stringop-overread -Wno-stringop-overflow -Wno-cpp -UNDEBUG
INFO     root:dir_util.py:58 creating build/lib.linux-x86_64-cpython-314
INFO     root:spawn.py:77 x86_64-linux-gnu-gcc -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-z,relro -g -fwrapv -O2 -Wl,-z,relro -Wl,-z,now -Wdate-time -D_FORTIFY_SOURCE=2 build/temp.linux-x86_64-cpython-314/build/__native.o -L/usr/lib/x86_64-linux-gnu -o build/lib.linux-x86_64-cpython-314/native.cpython-314-x86_64-linux-gnu.so
INFO     root:file_util.py:130 copying build/lib.linux-x86_64-cpython-314/native.cpython-314-x86_64-linux-gnu.so ->

Is this important, or can we freely ignore this test and publish mypy 1.20.0 to Debian? Or should we wait until a fix is agreed upon?

Activity

  1. added
    bugmypy got something wrong
    on Mar 31, 2026
  2. ilevkivskyi commented on Mar 31, 2026

    @ilevkivskyi
    Member

    cc @JukkaL, but I guess it is safe to ignore for now.

  3. cdce8p commented on Mar 31, 2026

    @cdce8p
    Collaborator

    On a related note, the same test case will start to emit FutureWarnings for Python 3.15 caused by python/cpython#141128 here:

    def test_urlsafe_b64decode() -> None:
    # Don't test everything, since the implementation is mostly shared with b64decode.
    check_urlsafe_decode(b"")
    check_urlsafe_decode(b"a")
    check_urlsafe_decode(b"\xf8")
    check_urlsafe_decode(b"\xfc")
    check_urlsafe_decode(b"\xfcx")
    check_urlsafe_decode(b"\xfcxy")
    check_urlsafe_decode(b"\xfcxyz")
    check_urlsafe_decode(bytes([x for x in range(256)]))

    [out]
    driver.py:28: FutureWarning: invalid character '+' in URL-safe Base64 data will be discarded in future Python versions
      test_func()
    driver.py:28: FutureWarning: invalid character '/' in URL-safe Base64 data will be discarded in future Python versions
      test_func()
    
  4. ilevkivskyi commented on Apr 8, 2026

    @ilevkivskyi
    Member

    OK, it looks like this started causing troubles for real: see test failures in #21175 I guess we can simply update the test. Or do we actually need to update our base64 implementation to be more strict as well?

  5. mr-c commented on Apr 8, 2026

    @mr-c
    ContributorAuthor

    Yeah, Python 3.14.4 is officially out: https://www.python.org/downloads/release/python-3144/

    For Python 3.15 I would recommend to match the stricter behavior for sure.

    Since you can detect the micro version at run time, it makes sense to also be stricter for Python 3.14.4+, to prevent interoperability issues

  6. ilevkivskyi commented on Apr 9, 2026

    @ilevkivskyi
    Member

    For now I am skipping the tests in #21193 (to unblock multiple pending PRs), we can apply an actual fix later.

  7. self-assigned this
    on Apr 9, 2026
  8. added a commit that references this issue on Apr 10, 2026
    c6d938e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugmypy got something wrong

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions