Bug 2342754 - python-twisted fails to build with Python 3.14: RuntimeError: There is no current event loop in thread 'MainThread'. + more
Summary: python-twisted fails to build with Python 3.14: RuntimeError: There is no cur...
Keywords:
Status: NEW
Alias: None
Product: Fedora
Classification: Fedora
Component: python-twisted
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Jonathan Wright
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: PYTHON3.14
TreeView+ depends on / blocked
 
Reported: 2025-01-29 08:39 UTC by Karolina Surma
Modified: 2025-03-05 10:33 UTC (History)
5 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed:
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github twisted twisted issues 12426 0 None open [heads-up] Python 3.14 removes the implicit event loop creation with asyncio.get_event_loop() 2025-02-19 16:20:03 UTC
Github twisted twisted issues 12427 0 None open [heads-up] Python 3.14: test_noFragments fails: `b'http://foo.com/quux#' != b'http://foo.com/quux'` 2025-02-19 16:20:03 UTC
Github twisted twisted issues 12428 0 None open [heads-up] Python 3.14: "BrokenImplementation" in test_httpauth.BasicAuthTests.test_incorrectPadding 2025-02-19 16:20:03 UTC
Github twisted twisted issues 12429 0 None open [heads-up] Python 3.14: `locale.Error: unsupported locale setting` in test_cftp and test_utf8 2025-02-19 16:20:03 UTC

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.


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