Skip to content

Commit

Permalink
No one uses string exceptions anymore.
Browse files Browse the repository at this point in the history
  • Loading branch information
pythonspeed committed Mar 13, 2024
1 parent 68778c0 commit cb535ae
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 11 deletions.
3 changes: 0 additions & 3 deletions src/twisted/python/failure.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,9 +289,6 @@ def __init__(self, exc_value=None, exc_type=None, exc_tb=None, captureVars=False
self.type = self.value = tb = None
self.captureVars = captureVars

if isinstance(exc_value, str) and exc_type is None:
raise TypeError("Strings are not supported by Failure")

stackOffset = 0

if exc_value is None:
Expand Down
8 changes: 0 additions & 8 deletions src/twisted/test/test_failure.py
Original file line number Diff line number Diff line change
Expand Up @@ -398,14 +398,6 @@ def test_RaiseExceptionWithTB(self) -> None:
innerline = self._getInnermostFrameLine(f)
self.assertEqual(innerline, "1 / 0")

def test_stringExceptionConstruction(self) -> None:
"""
Constructing a C{Failure} with a string as its exception value raises
a C{TypeError}, as this is no longer supported as of Python 2.6.
"""
exc = self.assertRaises(TypeError, failure.Failure, "ono!")
self.assertIn("Strings are not supported by Failure", str(exc))

def test_ConstructionFails(self) -> None:
"""
Creating a Failure with no arguments causes it to try to discover the
Expand Down

0 comments on commit cb535ae

Please sign in to comment.