Fedora Account System
Red Hat Associate
Red Hat Customer
python-pydantic fails to build with Python 3.15.0a8. There are 5 total test failures: 4 times DID NOT RAISE, and FutureWarning ____________ test_base64url[Base64UrlBytes-bytes-alphabet-vanilla] _____________ field_type = typing.Annotated[bytes, EncodedBytes(encoder=<class 'pydantic.types.Base64UrlEncoder'>)] input_data = b'BCq+6+1/Paun/Q==' expected_value = b'\x04*\xbe\xeb\xed\x7f=\xab\xa7\xfd' serialized_data = b'BCq-6-1_Paun_Q==' @pytest.mark.parametrize( ('field_type', 'input_data', 'expected_value', 'serialized_data'), [ pytest.param(Base64UrlBytes, b'Zm9vIGJhcg==\n', b'foo bar', b'Zm9vIGJhcg==', id='Base64UrlBytes-reversible'), pytest.param(Base64UrlStr, 'Zm9vIGJhcg==\n', 'foo bar', 'Zm9vIGJhcg==', id='Base64UrlStr-reversible'), pytest.param(Base64UrlBytes, b'Zm9vIGJhcg==', b'foo bar', b'Zm9vIGJhcg==', id='Base64UrlBytes-bytes-input'), pytest.param(Base64UrlBytes, 'Zm9vIGJhcg==', b'foo bar', b'Zm9vIGJhcg==', id='Base64UrlBytes-str-input'), pytest.param( Base64UrlBytes, bytearray(b'Zm9vIGJhcg=='), b'foo bar', b'Zm9vIGJhcg==', id='Base64UrlBytes-bytearray-input' ), pytest.param(Base64UrlStr, b'Zm9vIGJhcg==', 'foo bar', 'Zm9vIGJhcg==', id='Base64UrlStr-bytes-input'), pytest.param(Base64UrlStr, 'Zm9vIGJhcg==', 'foo bar', 'Zm9vIGJhcg==', id='Base64UrlStr-str-input'), pytest.param( Base64UrlStr, bytearray(b'Zm9vIGJhcg=='), 'foo bar', 'Zm9vIGJhcg==', id='Base64UrlStr-bytearray-input' ), pytest.param( Base64UrlBytes, b'BCq-6-1_Paun_Q==', b'\x04*\xbe\xeb\xed\x7f=\xab\xa7\xfd', b'BCq-6-1_Paun_Q==', id='Base64UrlBytes-bytes-alphabet-url', ), pytest.param( Base64UrlBytes, b'BCq+6+1/Paun/Q==', b'\x04*\xbe\xeb\xed\x7f=\xab\xa7\xfd', b'BCq-6-1_Paun_Q==', id='Base64UrlBytes-bytes-alphabet-vanilla', ), ], ) def test_base64url(field_type, input_data, expected_value, serialized_data): class Model(BaseModel): base64url_value: field_type base64url_value_or_none: Optional[field_type] = None > m = Model(base64url_value=input_data) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ tests/test_types.py:5683: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ pydantic/types.py:2553: in decode return self.encoder.decode(data) ^^^^^^^^^^^^^^^^^^^^^^^^^ pydantic/types.py:2445: in decode return base64.urlsafe_b64decode(data) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ s = b'BCq+6+1/Paun/Q==' def urlsafe_b64decode(s, *, padded=False): """Decode bytes using the URL- and filesystem-safe Base64 alphabet. Argument s is a bytes-like object or ASCII string to decode. The result is returned as a bytes object. A binascii.Error is raised if the input is incorrectly padded. Characters that are not in the URL-safe base-64 alphabet, and are not a plus '+' or slash '/', are discarded prior to the padding check. If padded is false, padding in input is not required. The alphabet uses '-' instead of '+' and '_' instead of '/'. """ s = _bytes_from_decode_data(s) badchar = None for b in b'+/': if b in s: badchar = b break s = s.translate(_urlsafe_decode_translation) result = binascii.a2b_base64(s, strict_mode=False, padded=padded) if badchar is not None: import warnings > warnings.warn(f'invalid character {chr(badchar)!a} in URL-safe Base64 data ' f'will be discarded in future Python versions', FutureWarning, stacklevel=2) E FutureWarning: invalid character '+' in URL-safe Base64 data will be discarded in future Python versions /usr/lib64/python3.15/base64.py:188: FutureWarning _________ test_base64url_invalid[Base64UrlBytes-invalid-base64-bytes] __________ field_type = typing.Annotated[bytes, EncodedBytes(encoder=<class 'pydantic.types.Base64UrlEncoder'>)] input_data = b'Zm9vIGJhcg' @pytest.mark.parametrize( ('field_type', 'input_data'), [ pytest.param(Base64UrlBytes, b'Zm9vIGJhcg', id='Base64UrlBytes-invalid-base64-bytes'), pytest.param(Base64UrlBytes, 'Zm9vIGJhcg', id='Base64UrlBytes-invalid-base64-str'), pytest.param(Base64UrlStr, b'Zm9vIGJhcg', id='Base64UrlStr-invalid-base64-bytes'), pytest.param(Base64UrlStr, 'Zm9vIGJhcg', id='Base64UrlStr-invalid-base64-str'), ], ) def test_base64url_invalid(field_type, input_data): class Model(BaseModel): base64url_value: field_type > with pytest.raises(ValidationError) as e: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ E Failed: DID NOT RAISE <class 'pydantic_core._pydantic_core.ValidationError'> https://docs.python.org/3.15/whatsnew/3.15.html For the build logs, see: https://copr-be.cloud.fedoraproject.org/results/@python/python3.15/fedora-rawhide-x86_64/10318780-python-pydantic/ For all our attempts to build python-pydantic with Python 3.15, see: https://copr.fedorainfracloud.org/coprs/g/python/python3.15/package/python-pydantic/ Testing and mass rebuild of packages is happening in copr. You can follow these instructions to test locally in mock if your package builds with Python 3.15: https://copr.fedorainfracloud.org/coprs/g/python/python3.15/ Let us know here if you have any questions. Python 3.15 is planned to be included in Fedora 45. To make that update smoother, we're building Fedora packages with all pre-releases of Python 3.15. A build failure prevents us from testing all dependent packages (transitive [Build]Requires), so if this package is required a lot, it's important for us to get it fixed soon. We'd appreciate help from the people who know this package best, but if you don't want to work on this now, let us know so we can try to work around it on our side.
There’s a new version of Pydantic available. It’s just been unblocked by PyO3 0.28. I haven’t had a chance to work on it yet. If this is anything like Python 3.14, Pydantic won’t have full support for 3.15 until very late in the release cycle, but at least the new version will likely give us a new and exciting set of failures!
All the test failures are quite straightforward. The package does not appear to be utterly broken. https://src.fedoraproject.org/rpms/python-pydantic/pull-request/55 skips 4 tests with bad data and ignores one FutureWarning.
I’m closing this since the failures have been worked around (thanks!), and full support will come from upstream in due course.