Bug 2327984

Summary: python-urwid fails to build with Python 3.14: RuntimeError: There is no current event loop in thread 'MainThread'.
Product: [Fedora] Fedora Reporter: Karolina Surma <ksurma>
Component: python-urwidAssignee: Tomas Tomecek <ttomecek>
Status: CLOSED COMPLETED QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: dick, ksurma, mhroncok, ttomecek
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2025-05-29 14:37:41 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 10:11:24 UTC
python-urwid fails to build with Python 3.14.0a2.

__________________ AsyncioEventLoopTest.test_run_in_executor ___________________

self = <tests.test_event_loops.AsyncioEventLoopTest testMethod=test_run_in_executor>

    def setUp(self):
>       self.evl = urwid.AsyncioEventLoop()

tests/test_event_loops.py:216: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
urwid/event_loop/asyncio_loop.py:83: in __init__
    self._loop = asyncio.get_event_loop()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

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

    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_event_loops.py::AsyncioEventLoopTest::test_coroutine_error - RuntimeError: There is no current event loop in thread 'MainThread'.
FAILED tests/test_event_loops.py::AsyncioEventLoopTest::test_error - RuntimeError: There is no current event loop in thread 'MainThread'.
FAILED tests/test_event_loops.py::AsyncioEventLoopTest::test_event_loop - RuntimeError: There is no current event loop in thread 'MainThread'.
FAILED tests/test_event_loops.py::AsyncioEventLoopTest::test_remove_alarm - RuntimeError: There is no current event loop in thread 'MainThread'.
FAILED tests/test_event_loops.py::AsyncioEventLoopTest::test_remove_watch_file - RuntimeError: There is no current event loop in thread 'MainThread'.
FAILED tests/test_event_loops.py::AsyncioEventLoopTest::test_run - RuntimeError: There is no current event loop in thread 'MainThread'.
FAILED tests/test_event_loops.py::AsyncioEventLoopTest::test_run_in_executor - RuntimeError: There is no current event loop in thread 'MainThread'.
=========== 7 failed, 285 passed, 28 skipped, 221 warnings in 4.98s ============

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.)


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/08293077-python-urwid/

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

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 Tomas Tomecek 2024-11-25 09:33:04 UTC
Thanks for the report! I opened an issue upstream: https://github.com/urwid/urwid/issues/951

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

Comment 3 Dick Marinus 2025-05-29 14:37:41 UTC
This has been fixed in https://bodhi.fedoraproject.org/updates/FEDORA-2025-77e452d4e3