Bug 2165539

Summary: python-ssdp fails to build with Python 3.12: RuntimeError: There is no current event loop in thread 'MainThread'.
Product: [Fedora] Fedora Reporter: Tomáš Hrnčiar <thrnciar>
Component: python-ssdpAssignee: Fabian Affolter <mail>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 38CC: mail, mhroncok, thrnciar
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: python-ssdp-1.3.0-1.fc40 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2024-01-07 17:18:22 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: 2135404    

Description Tomáš Hrnčiar 2023-01-30 12:00:47 UTC
python-ssdp fails to build with Python 3.12.0a4.

=================================== FAILURES ===================================
_________________________ TestSSDPRequest.test_sendto __________________________

self = <tests.test_ssdp.TestSSDPRequest object at 0x7fdad3fa6d80>

    def test_sendto(self):
        requests = []
    
        class MyProtocol(SimpleServiceDiscoveryProtocol):
    
            def response_received(self, response, addr):
                print(response, addr)
    
            def request_received(self, request, addr):
                requests.append(request)
                print(request, addr)
    
>       loop = asyncio.get_event_loop()

tests/test_ssdp.py:93: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

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

    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.12/asyncio/events.py:676: RuntimeError
=========================== short test summary info ============================
FAILED tests/test_ssdp.py::TestSSDPRequest::test_sendto - RuntimeError: There...
========================= 1 failed, 11 passed in 0.05s =========================

The get_event_loop() method of the default event loop policy now emits a
DeprecationWarning if there is no current event loop set and it decides to
create one. (Contributed by Serhiy Storchaka and Guido van Rossum in
gh-100160.)

asyncio.get_event_loop() and many other asyncio
functions like ensure_future(), shield() or gather(), and also the
get_event_loop() method of BaseDefaultEventLoopPolicy now raise a RuntimeError
if called when there is no running event loop and the current event loop was
not set. Previously they implicitly created and set a new current event loop.
DeprecationWarning is no longer emitted if there is no running event loop but
the current event loop is set in the policy. (Contributed by Serhiy Storchaka
in gh-93453.)

https://github.com/python/cpython/issues/100160
https://github.com/python/cpython/issues/93453

https://docs.python.org/3.12/whatsnew/3.12.html

For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.12/fedora-rawhide-x86_64/05275857-python-ssdp/

For all our attempts to build python-ssdp with Python 3.12, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.12/package/python-ssdp/

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.12:
https://copr.fedorainfracloud.org/coprs/g/python/python3.12/

Let us know here if you have any questions.

Python 3.12 is planned to be included in Fedora 39. To make that update smoother, we're building Fedora packages with all pre-releases of Python 3.12.
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 Cotton 2023-02-07 15:07:00 UTC
This bug appears to have been reported against 'rawhide' during the Fedora Linux 38 development cycle.
Changing version to 38.

Comment 2 Fedora Update System 2024-01-07 17:16:06 UTC
FEDORA-2024-3e50b0ca0f has been submitted as an update to Fedora 40. https://bodhi.fedoraproject.org/updates/FEDORA-2024-3e50b0ca0f

Comment 3 Fedora Update System 2024-01-07 17:18:22 UTC
FEDORA-2024-3e50b0ca0f has been pushed to the Fedora 40 stable repository.
If problem still persists, please make note of it in this bug report.