Bug 2327978 - python-inject fails to build with Python 3.14: RuntimeError: There is no current event loop in thread 'MainThread'.
Summary: python-inject fails to build with Python 3.14: RuntimeError: There is no curr...
Keywords:
Status: NEW
Alias: None
Product: Fedora
Classification: Fedora
Component: python-inject
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Artur Frenszek-Iwicki
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
: 2371945 (view as bug list)
Depends On:
Blocks: PYTHON3.14 F43FTBFS, RAWHIDEFTBFS F43FailsToInstall, RAWHIDEFailsToInstall 2371699
TreeView+ depends on / blocked
 
Reported: 2024-11-22 10:07 UTC by Karolina Surma
Modified: 2025-06-11 16:31 UTC (History)
4 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed:
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Karolina Surma 2024-11-22 10:07:50 UTC
python-inject fails to build with Python 3.14.0a2.

______________________ TestInjectParams.test_async_params ______________________

self = <test.test_params.TestInjectParams testMethod=test_async_params>

    def test_async_params(self):
        @inject.params(val=int)
        async def test_func(val):
            return val
    
        inject.configure(lambda binder: binder.bind(int, 123))
    
        assert inspect.iscoroutinefunction(test_func)
>       assert self.run_async(test_func()) == 123

test/test_params.py:147: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <test.test_params.TestInjectParams testMethod=test_async_params>
awaitable = <coroutine object TestInjectParams.test_async_params.<locals>.test_func at 0x7f1c766b5d20>

    def run_async(self, awaitable):
>       loop = asyncio.get_event_loop()

test/__init__.py:11: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <asyncio.unix_events._UnixDefaultEventLoopPolicy object at 0x7f1c770c67b0>

    def get_event_loop(self):
        """Get the event loop for the current context.
    
        Returns an instance of EventLoop or raises an exception.
        """
        if self._local._loop is None:
>           raise RuntimeError('There is no current event loop in thread %r.'
                               % threading.current_thread().name)
E           RuntimeError: There is no current event loop in thread 'MainThread'.

/usr/lib64/python3.14/asyncio/events.py:681: RuntimeError
=========================== short test summary info ============================
FAILED test/test_context_manager.py::TestContextManagerFunctional::test_provider_as_context_manager_async
FAILED test/test_param.py::TestInjectParams::test_async_param - RuntimeError:...
FAILED test/test_params.py::TestInjectParams::test_async_params - RuntimeErro...
========================= 3 failed, 55 passed in 0.16s =========================

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

Removed implicit creation of event loop by asyncio.get_event_loop(). It now raises a RuntimeError if there is no current event loop. (Contributed by Kumar Aditya in gh-126353.)


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

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

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:31 UTC
This bug appears to have been reported against 'rawhide' during the Fedora Linux 42 development cycle.
Changing version to 42.

Comment 2 Karolina Surma 2025-06-11 15:59:48 UTC
*** Bug 2371945 has been marked as a duplicate of this bug. ***


Note You need to log in before you can comment on or make changes to this bug.