Bug 2327988 - python-throttler fails to build with Python 3.14: RuntimeError: There is no current event loop in thread 'MainThread'.
Summary: python-throttler fails to build with Python 3.14: RuntimeError: There is no c...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: python-throttler
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Ben Beasley
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks: PYTHON3.14
TreeView+ depends on / blocked
 
Reported: 2024-11-22 10:16 UTC by Karolina Surma
Modified: 2024-11-23 13:29 UTC (History)
4 users (show)

Fixed In Version: python-throttler-1.2.2-13.fc42
Clone Of:
Environment:
Last Closed: 2024-11-23 13:29:31 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github uburuntu throttler pull 6 0 None open Fix tests for Python 3.14 2024-11-23 13:14:49 UTC

Description Karolina Surma 2024-11-22 10:16:03 UTC
python-throttler fails to build with Python 3.14.0a2.

_______ TestThrottlerSimultaneous.test_via_service_simultaneous[100-500] _______
[gw1] linux -- Python 3.14.0 /usr/bin/python3

self = <tests.test_throttler_simultaneous.TestThrottlerSimultaneous object at 0x7f01ee6b7a80>
max_simultaneous = 100, count = 500

    @pytest.mark.parametrize(
        ('max_simultaneous', 'count'), ((1, 10), (3, 10), (100, 500))
    )
    def test_via_service_simultaneous(self, max_simultaneous: int, count: int):
        s = ServiceSimultaneous(max_simultaneous)
    
        @throttle_simultaneous(max_simultaneous)
        async def request(value: float):
            return await s.get(value)
    
>       main = asyncio.gather(*[request(v) for v in range(count)])

tests/test_throttler_simultaneous.py:20: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/usr/lib64/python3.14/asyncio/tasks.py:869: in gather
    fut = ensure_future(arg, loop=loop)
/usr/lib64/python3.14/asyncio/tasks.py:731: in ensure_future
    loop = events.get_event_loop()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

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

    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 tests/test_service.py::TestService::test_service[100-1.5] - RuntimeErr...
FAILED tests/test_service.py::TestService::test_service_simultaneous[1] - Run...
FAILED tests/test_service.py::TestService::test_service_simultaneous[3] - Run...
FAILED tests/test_service.py::TestService::test_service_simultaneous[100] - R...
FAILED tests/test_throttler.py::TestThrottler::test_via_service[1-0.5-3] - Ru...
FAILED tests/test_throttler.py::TestThrottler::test_via_service[1-0.5-5] - Ru...
FAILED tests/test_throttler.py::TestThrottler::test_via_service[1-0.5-7] - Ru...
FAILED tests/test_throttler.py::TestThrottler::test_via_service[1-1.0-3] - Ru...
FAILED tests/test_throttler.py::TestThrottler::test_via_service[1-1.0-5] - Ru...
FAILED tests/test_throttler.py::TestThrottler::test_via_service[1-1.0-7] - Ru...
FAILED tests/test_throttler.py::TestThrottler::test_via_service[1-1.5-3] - Ru...
FAILED tests/test_throttler.py::TestThrottler::test_via_service[1-1.5-5] - Ru...
FAILED tests/test_throttler.py::TestThrottler::test_via_service[1-1.5-7] - Ru...
FAILED tests/test_throttler.py::TestThrottler::test_via_service[3-0.5-3] - Ru...
FAILED tests/test_throttler.py::TestThrottler::test_via_service[3-0.5-5] - Ru...
FAILED tests/test_throttler.py::TestThrottler::test_via_service[3-0.5-7] - Ru...
FAILED tests/test_throttler.py::TestThrottler::test_via_service[3-1.0-3] - Ru...
FAILED tests/test_throttler.py::TestThrottler::test_via_service[3-1.0-5] - Ru...
FAILED tests/test_throttler.py::TestThrottler::test_via_service[3-1.0-7] - Ru...
FAILED tests/test_throttler.py::TestThrottler::test_via_service[3-1.5-3] - Ru...
FAILED tests/test_throttler.py::TestThrottler::test_via_service[3-1.5-5] - Ru...
FAILED tests/test_throttler.py::TestThrottler::test_via_service[3-1.5-7] - Ru...
FAILED tests/test_throttler.py::TestThrottler::test_via_service[5-0.5-3] - Ru...
FAILED tests/test_throttler.py::TestThrottler::test_via_service[5-0.5-5] - Ru...
FAILED tests/test_throttler.py::TestThrottler::test_via_service[5-0.5-7] - Ru...
FAILED tests/test_throttler.py::TestThrottler::test_via_service[5-1.0-3] - Ru...
FAILED tests/test_throttler.py::TestThrottler::test_via_service[5-1.0-5] - Ru...
FAILED tests/test_throttler.py::TestThrottler::test_via_service[5-1.0-7] - Ru...
FAILED tests/test_throttler.py::TestThrottler::test_via_service[5-1.5-3] - Ru...
FAILED tests/test_throttler.py::TestThrottler::test_via_service[5-1.5-5] - Ru...
FAILED tests/test_throttler.py::TestThrottler::test_via_service[5-1.5-7] - Ru...
FAILED tests/test_throttler.py::TestThrottler::test_via_service[100-0.5-10]
FAILED tests/test_throttler.py::TestThrottler::test_via_service[100-0.5-1000]
FAILED tests/test_throttler.py::TestThrottler::test_via_service[100-1.0-10]
FAILED tests/test_throttler.py::TestThrottler::test_via_service[100-1.0-1000]
FAILED tests/test_throttler.py::TestThrottler::test_via_service[100-1.5-10]
FAILED tests/test_throttler.py::TestThrottler::test_via_service[100-1.5-1000]
FAILED tests/test_throttler.py::TestThrottler::test_via_service[1000-0.5-10]
FAILED tests/test_throttler.py::TestThrottler::test_via_service[1000-0.5-1000]
FAILED tests/test_throttler.py::TestThrottler::test_via_service[1000-1.0-10]
FAILED tests/test_throttler.py::TestThrottler::test_via_service[1000-1.0-1000]
FAILED tests/test_throttler.py::TestThrottler::test_via_service[1000-1.5-10]
FAILED tests/test_throttler.py::TestThrottler::test_via_service[1000-1.5-1000]
FAILED tests/test_throttler_simultaneous.py::TestThrottlerSimultaneous::test_via_service_simultaneous[1-10]
FAILED tests/test_throttler_simultaneous.py::TestThrottlerSimultaneous::test_via_service_simultaneous[3-10]
FAILED tests/test_throttler_simultaneous.py::TestThrottlerSimultaneous::test_via_service_simultaneous[100-500]
======================== 46 failed, 34 passed in 42.82s ========================

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/08292984-python-throttler/

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

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 Ben Beasley 2024-11-23 13:14:49 UTC
This is simpler than bug 2327989 – only the tests are affected – and I was able to propose a fix in https://github.com/uburuntu/throttler/pull/6 (https://src.fedoraproject.org/rpms/python-throttler/pull-request/1).

Comment 2 Fedora Update System 2024-11-23 13:24:53 UTC
FEDORA-2024-207c966df1 (python-throttler-1.2.2-13.fc42) has been submitted as an update to Fedora 42.
https://bodhi.fedoraproject.org/updates/FEDORA-2024-207c966df1

Comment 3 Fedora Update System 2024-11-23 13:29:31 UTC
FEDORA-2024-207c966df1 (python-throttler-1.2.2-13.fc42) has been pushed to the Fedora 42 stable repository.
If problem still persists, please make note of it in this bug report.


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