Bug 2342754

Summary: python-twisted fails to build with Python 3.14: RuntimeError: There is no current event loop in thread 'MainThread'. + more
Product: [Fedora] Fedora Reporter: Karolina Surma <ksurma>
Component: python-twistedAssignee: Jonathan Wright <jonathan>
Status: NEW --- QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: eclipseo, jonathan, ksurma, mhroncok, python-packagers-sig, yaneti
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: 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 2025-01-29 08:39:55 UTC
python-twisted fails to build with Python 3.14.0a4.

twisted.web.test.test_tap.ServiceTests.test_HTTPSFailureOnMissingSSL
===============================================================================
[FAIL]
Traceback (most recent call last):
  File "/builddir/build/BUILD/python-twisted-24.10.0-build/twisted-twisted-24.10.0/src/twisted/web/test/test_webclient.py", line 26, in test_noFragments
    self.assertEqual(
  File "/builddir/build/BUILD/python-twisted-24.10.0-build/twisted-twisted-24.10.0/src/twisted/trial/_synctest.py", line 444, in assertEqual
    super().assertEqual(first, second, msg)
  File "/usr/lib64/python3.14/unittest/case.py", line 916, in assertEqual
    assertion_func(first, second, msg=msg)
  File "/usr/lib64/python3.14/unittest/case.py", line 909, in _baseAssertEqual
    raise self.failureException(msg)
twisted.trial.unittest.FailTest: b'http://foo.com/quux#' != b'http://foo.com/quux'

twisted.web.test.test_webclient.URLJoinTests.test_noFragments
===============================================================================
[ERROR]
Traceback (most recent call last):
  File "/builddir/build/BUILD/python-twisted-24.10.0-build/twisted-twisted-24.10.0/src/twisted/internet/test/test_asyncioreactor.py", line 106, in test_defaultSelectorEventLoopFromGlobalPolicy
    reactor = AsyncioSelectorReactor()
  File "/builddir/build/BUILD/python-twisted-24.10.0-build/twisted-twisted-24.10.0/src/twisted/internet/asyncioreactor.py", line 50, in __init__
    _eventloop: AbstractEventLoop = get_event_loop()
  File "/usr/lib64/python3.14/asyncio/events.py", line 719, in get_event_loop
    raise RuntimeError('There is no current event loop in thread %r.'
builtins.RuntimeError: There is no current event loop in thread 'MainThread'.

twisted.internet.test.test_asyncioreactor.AsyncioSelectorReactorTests.test_defaultSelectorEventLoopFromGlobalPolicy
===============================================================================
[ERROR]
Traceback (most recent call last):
  File "/builddir/build/BUILD/python-twisted-24.10.0-build/twisted-twisted-24.10.0/src/twisted/internet/test/test_asyncioreactor.py", line 248, in test_delayedCallResetToEarlier
    reactor = AsyncioSelectorReactor()
  File "/builddir/build/BUILD/python-twisted-24.10.0-build/twisted-twisted-24.10.0/src/twisted/internet/asyncioreactor.py", line 50, in __init__
    _eventloop: AbstractEventLoop = get_event_loop()
  File "/usr/lib64/python3.14/asyncio/events.py", line 719, in get_event_loop
    raise RuntimeError('There is no current event loop in thread %r.'
builtins.RuntimeError: There is no current event loop in thread 'MainThread'.

twisted.internet.test.test_asyncioreactor.AsyncioSelectorReactorTests.test_delayedCallResetToEarlier
===============================================================================
[ERROR]
Traceback (most recent call last):
  File "/builddir/build/BUILD/python-twisted-24.10.0-build/twisted-twisted-24.10.0/src/twisted/internet/test/test_asyncioreactor.py", line 226, in test_delayedCallResetToLater
    reactor = AsyncioSelectorReactor()
  File "/builddir/build/BUILD/python-twisted-24.10.0-build/twisted-twisted-24.10.0/src/twisted/internet/asyncioreactor.py", line 50, in __init__
    _eventloop: AbstractEventLoop = get_event_loop()
  File "/usr/lib64/python3.14/asyncio/events.py", line 719, in get_event_loop
    raise RuntimeError('There is no current event loop in thread %r.'
builtins.RuntimeError: There is no current event loop in thread 'MainThread'.

twisted.internet.test.test_asyncioreactor.AsyncioSelectorReactorTests.test_delayedCallResetToLater
===============================================================================
[ERROR]
Traceback (most recent call last):
  File "/builddir/build/BUILD/python-twisted-24.10.0-build/twisted-twisted-24.10.0/src/twisted/internet/test/test_asyncioreactor.py", line 125, in test_newSelectorEventLoopFromDefaultEventLoopPolicy
    event_loop = self.newLoop(DefaultEventLoopPolicy())
  File "/builddir/build/BUILD/python-twisted-24.10.0-build/twisted-twisted-24.10.0/src/twisted/internet/test/test_asyncioreactor.py", line 77, in newLoop
    existingLoop = get_event_loop()
  File "/usr/lib64/python3.14/asyncio/events.py", line 719, in get_event_loop
    raise RuntimeError('There is no current event loop in thread %r.'
builtins.RuntimeError: There is no current event loop in thread 'MainThread'.

twisted.internet.test.test_asyncioreactor.AsyncioSelectorReactorTests.test_newSelectorEventLoopFromDefaultEventLoopPolicy
===============================================================================
[ERROR]
Traceback (most recent call last):
  File "/builddir/build/BUILD/python-twisted-24.10.0-build/twisted-twisted-24.10.0/src/twisted/internet/test/test_asyncioreactor.py", line 285, in test_noCycleReferencesInCallLater
    reactor = AsyncioSelectorReactor()
  File "/builddir/build/BUILD/python-twisted-24.10.0-build/twisted-twisted-24.10.0/src/twisted/internet/asyncioreactor.py", line 50, in __init__
    _eventloop: AbstractEventLoop = get_event_loop()
  File "/usr/lib64/python3.14/asyncio/events.py", line 719, in get_event_loop
    raise RuntimeError('There is no current event loop in thread %r.'
builtins.RuntimeError: There is no current event loop in thread 'MainThread'.

twisted.internet.test.test_asyncioreactor.AsyncioSelectorReactorTests.test_noCycleReferencesInCallLater
===============================================================================
[ERROR]
Traceback (most recent call last):
  File "/builddir/build/BUILD/python-twisted-24.10.0-build/twisted-twisted-24.10.0/src/twisted/internet/test/test_asyncioreactor.py", line 209, in test_seconds
    reactor = AsyncioSelectorReactor()
  File "/builddir/build/BUILD/python-twisted-24.10.0-build/twisted-twisted-24.10.0/src/twisted/internet/asyncioreactor.py", line 50, in __init__
    _eventloop: AbstractEventLoop = get_event_loop()
  File "/usr/lib64/python3.14/asyncio/events.py", line 719, in get_event_loop
    raise RuntimeError('There is no current event loop in thread %r.'
builtins.RuntimeError: There is no current event loop in thread 'MainThread'.

twisted.internet.test.test_asyncioreactor.AsyncioSelectorReactorTests.test_seconds
===============================================================================
[ERROR]
Traceback (most recent call last):
  File "/builddir/build/BUILD/python-twisted-24.10.0-build/twisted-twisted-24.10.0/src/twisted/test/test_sslverify.py", line 2864, in test_doesNotStumbleOverEmptyList
    tuple(), sslverify._expandCipherString("", SSL.SSLv23_METHOD, 0)
  File "/builddir/build/BUILD/python-twisted-24.10.0-build/twisted-twisted-24.10.0/src/twisted/internet/_sslverify.py", line 1739, in _expandCipherString
    ctx.set_cipher_list(cipherString.encode("ascii"))
  File "/usr/lib/python3.14/site-packages/OpenSSL/SSL.py", line 1445, in set_cipher_list
    _openssl_assert(
  File "/usr/lib/python3.14/site-packages/OpenSSL/_util.py", line 76, in openssl_assert
    exception_from_error_queue(error)
  File "/usr/lib/python3.14/site-packages/OpenSSL/_util.py", line 62, in exception_from_error_queue
    raise exception_type(errors)
OpenSSL.SSL.Error: [('configuration file routines', '', 'no value'), ('SSL routines', '', 'no cipher match')]

twisted.test.test_sslverify.ExpandCipherStringTests.test_doesNotStumbleOverEmptyList
===============================================================================
[ERROR]
Traceback (most recent call last):
  File "/builddir/build/BUILD/python-twisted-24.10.0-build/twisted-twisted-24.10.0/src/twisted/test/test_sslverify.py", line 914, in test_givesMeaningfulErrorMessageIfNoCipherMatches
    acceptableCiphers=sslverify.OpenSSLAcceptableCiphers.fromOpenSSLCipherString(
  File "/builddir/build/BUILD/python-twisted-24.10.0-build/twisted-twisted-24.10.0/src/twisted/internet/_sslverify.py", line 1806, in fromOpenSSLCipherString
    _expandCipherString(
  File "/builddir/build/BUILD/python-twisted-24.10.0-build/twisted-twisted-24.10.0/src/twisted/internet/_sslverify.py", line 1739, in _expandCipherString
    ctx.set_cipher_list(cipherString.encode("ascii"))
  File "/usr/lib/python3.14/site-packages/OpenSSL/SSL.py", line 1445, in set_cipher_list
    _openssl_assert(
  File "/usr/lib/python3.14/site-packages/OpenSSL/_util.py", line 76, in openssl_assert
    exception_from_error_queue(error)
  File "/usr/lib/python3.14/site-packages/OpenSSL/_util.py", line 62, in exception_from_error_queue
    raise exception_type(errors)
OpenSSL.SSL.Error: [('configuration file routines', '', 'no value'), ('SSL routines', '', 'no cipher match')]

twisted.test.test_sslverify.OpenSSLOptionsTests.test_givesMeaningfulErrorMessageIfNoCipherMatches
===============================================================================
[ERROR]
Traceback (most recent call last):
  File "/builddir/build/BUILD/python-twisted-24.10.0-build/twisted-twisted-24.10.0/src/twisted/web/test/test_httpauth.py", line 91, in test_incorrectPadding
    self.assertTrue(verifyObject(IUsernamePassword, creds))
  File "/usr/lib64/python3.14/site-packages/zope/interface/verify.py", line 183, in verifyObject
    return _verify(iface, candidate, tentative, vtype='o')
  File "/usr/lib64/python3.14/site-packages/zope/interface/verify.py", line 91, in _verify
    raise excs[0]
  File "/usr/lib64/python3.14/site-packages/zope/interface/verify.py", line 85, in _verify
    _verify_element(iface, name, desc, candidate, vtype)
  File "/usr/lib64/python3.14/site-packages/zope/interface/verify.py", line 109, in _verify_element
    raise BrokenImplementation(iface, desc, candidate)
zope.interface.exceptions.BrokenImplementation: The object <twisted.cred.credentials.UsernamePassword object at 0x7f05debc4b90> has failed to implement interface twisted.cred.credentials.IUsernamePassword: The twisted.cred.credentials.IUsernamePassword.__annotate__(format) attribute was not provided.

twisted.web.test.test_httpauth.BasicAuthTests.test_incorrectPadding
-------------------------------------------------------------------------------
Ran 11501 tests in 127.407s

FAILED (skips=1331, failures=1, errors=9, successes=10160)
Exception ignored in: <function gc_cumulative_time.<locals>.gc_callback at 0x7f05de34f270>
Traceback (most recent call last):
  File "/usr/lib/python3.14/site-packages/hypothesis/internal/conjecture/junkdrawer.py", line 444, in gc_callback
TypeError: 'NoneType' object is not callable
Exception ignored in: <function gc_cumulative_time.<locals>.gc_callback at 0x7f05de34f270>
Traceback (most recent call last):
  File "/usr/lib/python3.14/site-packages/hypothesis/internal/conjecture/junkdrawer.py", line 444, in gc_callback
TypeError: 'NoneType' object is not callable


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/08583571-python-twisted/

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

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