[PR #13502/01dce85a backport][8.4.x] Fix compatibility with Twisted 25 #13531
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a backport of PR #13502 as merged into main (01dce85).
The issue arises because
Failure.__init__
in Twisted 25 can receive a non-Noneexc_value
whileexc_tb
isNone
. In such cases,ExceptionInfo[BaseException].from_exc_info
fails, as it expects a traceback to be present whensys.exc_info()
returns a tuple. This leads to the error message'NoneType' object is not iterable
.Implemented separate workarounds for Twisted 24 and Twisted 25, the later one being simpler and less intrusive in the long run, as it does not require monkeypatching
Failure.__init__
.We can drop suppor for Twisted 24 and keep the simpler patch in a later release.
Fixes #13497