Bug 2367731

Summary: python-cloudpickle fails to build with Python 3.14: AttributeError: 'MyClass' object has no attribute '__annotations__'. Did you mean: '__annotations_cache__'
Product: [Fedora] Fedora Reporter: Karolina Surma <ksurma>
Component: python-cloudpickleAssignee: Lumír Balhar <lbalhar>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: epel-packagers-sig, jonathan, ksurma, lbalhar, mhroncok, python-packagers-sig
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: ---
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2025-05-27 07:59:28 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 2322407    

Description Karolina Surma 2025-05-21 07:14:27 UTC
python-cloudpickle fails to build with Python 3.14.0b1.

=================================== FAILURES ===================================
__________ CloudPickleTest.test_locally_defined_class_with_type_hints __________

self = <tests.cloudpickle_test.CloudPickleTest testMethod=test_locally_defined_class_with_type_hints>

    def test_locally_defined_class_with_type_hints(self):
        with subprocess_worker(protocol=self.protocol) as worker:
            for type_ in _all_types_to_test():
    
                class MyClass:
                    def method(self, arg: type_) -> type_:
                        return arg
    
                MyClass.__annotations__ = {"attribute": type_}
    
                def check_annotations(obj, expected_type, expected_type_str):
                    assert obj.__annotations__["attribute"] == expected_type
                    assert obj.method.__annotations__["arg"] == expected_type
                    assert obj.method.__annotations__["return"] == expected_type
                    return "ok"
    
                obj = MyClass()
>               assert check_annotations(obj, type_, "type_") == "ok"

tests/cloudpickle_test.py:2661: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

obj = <tests.cloudpickle_test.CloudPickleTest.test_locally_defined_class_with_type_hints.<locals>.MyClass object at 0x7f77f8341a90>
expected_type = <class 'tests.cloudpickle_test._all_types_to_test.<locals>.C'>
expected_type_str = 'type_'

    def check_annotations(obj, expected_type, expected_type_str):
>       assert obj.__annotations__["attribute"] == expected_type
E       AttributeError: 'MyClass' object has no attribute '__annotations__'. Did you mean: '__annotations_cache__'?

tests/cloudpickle_test.py:2655: AttributeError
_____ Protocol2CloudPickleTest.test_locally_defined_class_with_type_hints ______

self = <tests.cloudpickle_test.Protocol2CloudPickleTest testMethod=test_locally_defined_class_with_type_hints>

    def test_locally_defined_class_with_type_hints(self):
        with subprocess_worker(protocol=self.protocol) as worker:
            for type_ in _all_types_to_test():
    
                class MyClass:
                    def method(self, arg: type_) -> type_:
                        return arg
    
                MyClass.__annotations__ = {"attribute": type_}
    
                def check_annotations(obj, expected_type, expected_type_str):
                    assert obj.__annotations__["attribute"] == expected_type
                    assert obj.method.__annotations__["arg"] == expected_type
                    assert obj.method.__annotations__["return"] == expected_type
                    return "ok"
    
                obj = MyClass()
>               assert check_annotations(obj, type_, "type_") == "ok"

tests/cloudpickle_test.py:2661: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

obj = <tests.cloudpickle_test.CloudPickleTest.test_locally_defined_class_with_type_hints.<locals>.MyClass object at 0x7f77f91a7620>
expected_type = <class 'tests.cloudpickle_test._all_types_to_test.<locals>.C'>
expected_type_str = 'type_'

    def check_annotations(obj, expected_type, expected_type_str):
>       assert obj.__annotations__["attribute"] == expected_type
E       AttributeError: 'MyClass' object has no attribute '__annotations__'. Did you mean: '__annotations_cache__'?

tests/cloudpickle_test.py:2655: AttributeError
=========================== short test summary info ============================
FAILED tests/cloudpickle_test.py::CloudPickleTest::test_locally_defined_class_with_type_hints
FAILED tests/cloudpickle_test.py::Protocol2CloudPickleTest::test_locally_defined_class_with_type_hints
============ 2 failed, 241 passed, 27 skipped, 2 xfailed in 10.92s =============

https://docs.python.org/3.14/whatsnew/3.14.html

For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.14-b1/fedora-rawhide-x86_64/09068882-python-cloudpickle/

For all our attempts to build python-cloudpickle with Python 3.14, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.14-b1/package/python-cloudpickle/

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.14:
https://copr.fedorainfracloud.org/coprs/g/python/python3.14-b1/

Let us know here if you have any questions.

Python 3.14 is planned to be included in Fedora 43.
To make that update smoother, we're building Fedora packages with all pre-releases of Python 3.14.
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.