Bug 2327977 - python-tenacity fails to build with Python 3.14: RuntimeError: There is no current event loop in thread 'MainThread'.
Summary: python-tenacity fails to build with Python 3.14: RuntimeError: There is no cu...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: python-tenacity
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Sandro Bonazzola
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
: 2372160 (view as bug list)
Depends On:
Blocks: PYTHON3.14 F43FTBFS F43FailsToInstall 2292885 2328006 2371785 2371796 2371820 2371884 2371919 2371997 2371999 2372003 2372025 2372034 2372159 2372225 2372241
TreeView+ depends on / blocked
 
Reported: 2024-11-22 10:03 UTC by Karolina Surma
Modified: 2025-07-04 09:50 UTC (History)
10 users (show)

Fixed In Version: python-tenacity-9.1.2-1.fc43
Clone Of:
Environment:
Last Closed: 2025-07-04 09:50:36 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Fedora Package Sources python-tenacity pull-request 6 0 None None None 2025-06-17 10:30:08 UTC
Github jd tenacity issues 527 0 None open Test failures with Python 3.14: `RuntimeError: There is no current event loop in thread 'MainThread'. ` 2025-06-17 07:44:27 UTC
Github jd tenacity pull 528 0 None open Support Python 3.14 2025-06-17 10:03:38 UTC

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

________________________ TestContextManager.test_sleeps ________________________

a = (<tests.test_asyncio.TestContextManager testMethod=test_sleeps>,), kw = {}

    @wraps(callable_)
    def wrapper(*a, **kw):
>       loop = asyncio.get_event_loop()

tests/test_asyncio.py:34: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

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

    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_asyncio.py::TestAsync::test_attempt_number_is_correct_for_interleaved_coroutines
FAILED tests/test_asyncio.py::TestAsync::test_iscoroutinefunction - RuntimeEr...
FAILED tests/test_asyncio.py::TestAsync::test_retry - RuntimeError: There is ...
FAILED tests/test_asyncio.py::TestAsync::test_retry_using_async_retying - Run...
FAILED tests/test_asyncio.py::TestAsync::test_stop_after_attempt - RuntimeErr...
FAILED tests/test_asyncio.py::TestContextManager::test_async_retying_iterator
FAILED tests/test_asyncio.py::TestContextManager::test_do_max_attempts - Runt...
FAILED tests/test_asyncio.py::TestContextManager::test_reraise - RuntimeError...
FAILED tests/test_asyncio.py::TestContextManager::test_retry_with_result - Ru...
FAILED tests/test_asyncio.py::TestContextManager::test_sleeps - RuntimeError:...
================= 10 failed, 98 passed, 1 deselected in 2.42s ==================

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/08292961-python-tenacity/

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

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:29 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 16:05:03 UTC
*** Bug 2372160 has been marked as a duplicate of this bug. ***

Comment 3 Sandro Bonazzola 2025-06-17 07:44:27 UTC
Reported upstream at https://github.com/jd/tenacity/issues/527

Comment 4 Sandro Bonazzola 2025-06-17 10:03:38 UTC
Fix pushed upstream for review: https://github.com/jd/tenacity/pull/528

Comment 5 Sandro Bonazzola 2025-06-17 10:30:09 UTC
Pushed PR with the patch rebased on latest release: https://src.fedoraproject.org/rpms/python-tenacity/pull-request/6

Comment 6 Fedora Update System 2025-07-04 09:38:43 UTC
FEDORA-2025-26516cfcc5 (python-tenacity-9.1.2-1.fc43) has been submitted as an update to Fedora 43.
https://bodhi.fedoraproject.org/updates/FEDORA-2025-26516cfcc5

Comment 7 Fedora Update System 2025-07-04 09:50:36 UTC
FEDORA-2025-26516cfcc5 (python-tenacity-9.1.2-1.fc43) has been pushed to the Fedora 43 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.