From 74747e107d5f14c9fcdf053a66b8269c5221c05e Mon Sep 17 00:00:00 2001 From: ShaharNaveh <50263213+ShaharNaveh@users.noreply.github.com> Date: Fri, 12 Dec 2025 16:11:23 +0200 Subject: [PATCH 1/2] Update `test_raise.py` from 3.13.11 --- Lib/test/test_raise.py | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/Lib/test/test_raise.py b/Lib/test/test_raise.py index d7f01509078..53fce0a501d 100644 --- a/Lib/test/test_raise.py +++ b/Lib/test/test_raise.py @@ -187,18 +187,14 @@ def test_class_cause(self): @unittest.expectedFailure # TODO: RUSTPYTHON; TypeError: 'classmethod' object is not callable def test_class_cause_nonexception_result(self): - class ConstructsNone(BaseException): - @classmethod + # See https://github.com/python/cpython/issues/140530. + class ConstructMortal(BaseException): def __new__(*args, **kwargs): - return None - try: - raise IndexError from ConstructsNone - except TypeError as e: - self.assertIn("should have returned an instance of BaseException", str(e)) - except IndexError: - self.fail("Wrong kind of exception raised") - else: - self.fail("No exception raised") + return ["mortal value"] + + msg = ".*should have returned an instance of BaseException.*" + with self.assertRaisesRegex(TypeError, msg): + raise IndexError from ConstructMortal def test_instance_cause(self): cause = KeyError() From 779c26c3386e383b6117c1be4f63a49be833d2f1 Mon Sep 17 00:00:00 2001 From: ShaharNaveh <50263213+ShaharNaveh@users.noreply.github.com> Date: Fri, 12 Dec 2025 16:43:46 +0200 Subject: [PATCH 2/2] Trigger CI