Bug 2327965

Summary: python-flask fails to build with Python 3.14: AttributeError: module 'pkgutil' has no attribute 'get_loader'
Product: [Fedora] Fedora Reporter: Karolina Surma <ksurma>
Component: python-flaskAssignee: Karolina Surma <ksurma>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: epel-packagers-sig, fzatlouk, hushan.jia, karlthered, ksurma, mhroncok, patrick, python-packagers-sig, tdawson, tflink
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: python-flask-3.1.1-1.fc43 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2025-05-29 09:10:29 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 2024-11-22 09:02:32 UTC
python-flask fails to build with Python 3.14.0a1.

_____________ ERROR at setup of test_installed_module_paths[True] ______________

request = <SubRequest 'limit_loader' for <Function test_installed_module_paths[True]>>
monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7f1fe6bc77e0>

    @pytest.fixture(params=(True, False))
    def limit_loader(request, monkeypatch):
        """Patch pkgutil.get_loader to give loader without get_filename or archive.
    
        This provides for tests where a system has custom loaders, e.g. Google App
        Engine's HardenedModulesHook, which have neither the `get_filename` method
        nor the `archive` attribute.
    
        This fixture will run the testcase twice, once with and once without the
        limitation/mock.
        """
        if not request.param:
            return
    
        class LimitedLoader:
            def __init__(self, loader):
                self.loader = loader
    
            def __getattr__(self, name):
                if name in {"archive", "get_filename"}:
                    raise AttributeError(f"Mocking a loader which does not have {name!r}.")
                return getattr(self.loader, name)
    
>       old_get_loader = pkgutil.get_loader
E       AttributeError: module 'pkgutil' has no attribute 'get_loader'

tests/conftest.py:122: AttributeError
_____________ ERROR at setup of test_installed_package_paths[True] _____________

request = <SubRequest 'limit_loader' for <Function test_installed_package_paths[True]>>
monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7f1fe6bc7e70>

    @pytest.fixture(params=(True, False))
    def limit_loader(request, monkeypatch):
        """Patch pkgutil.get_loader to give loader without get_filename or archive.
    
        This provides for tests where a system has custom loaders, e.g. Google App
        Engine's HardenedModulesHook, which have neither the `get_filename` method
        nor the `archive` attribute.
    
        This fixture will run the testcase twice, once with and once without the
        limitation/mock.
        """
        if not request.param:
            return
    
        class LimitedLoader:
            def __init__(self, loader):
                self.loader = loader
    
            def __getattr__(self, name):
                if name in {"archive", "get_filename"}:
                    raise AttributeError(f"Mocking a loader which does not have {name!r}.")
                return getattr(self.loader, name)
    
>       old_get_loader = pkgutil.get_loader
E       AttributeError: module 'pkgutil' has no attribute 'get_loader'

tests/conftest.py:122: AttributeError
______________ ERROR at setup of test_prefix_package_paths[True] _______________

request = <SubRequest 'limit_loader' for <Function test_prefix_package_paths[True]>>
monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7f1fe6cb9b70>

    @pytest.fixture(params=(True, False))
    def limit_loader(request, monkeypatch):
        """Patch pkgutil.get_loader to give loader without get_filename or archive.
    
        This provides for tests where a system has custom loaders, e.g. Google App
        Engine's HardenedModulesHook, which have neither the `get_filename` method
        nor the `archive` attribute.
    
        This fixture will run the testcase twice, once with and once without the
        limitation/mock.
        """
        if not request.param:
            return
    
        class LimitedLoader:
            def __init__(self, loader):
                self.loader = loader
    
            def __getattr__(self, name):
                if name in {"archive", "get_filename"}:
                    raise AttributeError(f"Mocking a loader which does not have {name!r}.")
                return getattr(self.loader, name)
    
>       old_get_loader = pkgutil.get_loader
E       AttributeError: module 'pkgutil' has no attribute 'get_loader'


According to https://docs.python.org/dev/whatsnew/3.14.html#multiprocessing

Remove deprecated pkgutil.get_loader() and pkgutil.find_loader(). These had previously raised a DeprecationWarning since Python 3.12. (Contributed by Bénédikt Tran in gh-97850.)


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/fedora-rawhide-x86_64/08300617-python-flask/

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

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/

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.

Comment 1 Aoife Moloney 2025-02-26 13:17:18 UTC
This bug appears to have been reported against 'rawhide' during the Fedora Linux 42 development cycle.
Changing version to 42.