diff options
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/ctypes/test/test_as_parameter.py | 2 | ||||
-rw-r--r-- | Lib/test/exception_hierarchy.txt | 1 | ||||
-rw-r--r-- | Lib/test/list_tests.py | 2 | ||||
-rw-r--r-- | Lib/test/test_class.py | 4 | ||||
-rw-r--r-- | Lib/test/test_compile.py | 2 | ||||
-rw-r--r-- | Lib/test/test_copy.py | 6 | ||||
-rw-r--r-- | Lib/test/test_descr.py | 6 | ||||
-rw-r--r-- | Lib/test/test_dictviews.py | 2 | ||||
-rw-r--r-- | Lib/test/test_exceptions.py | 13 | ||||
-rw-r--r-- | Lib/test/test_isinstance.py | 10 | ||||
-rw-r--r-- | Lib/test/test_json/test_recursion.py | 12 | ||||
-rw-r--r-- | Lib/test/test_pickle.py | 3 | ||||
-rw-r--r-- | Lib/test/test_richcmp.py | 24 | ||||
-rw-r--r-- | Lib/test/test_runpy.py | 2 | ||||
-rw-r--r-- | Lib/test/test_sys.py | 6 | ||||
-rw-r--r-- | Lib/test/test_threading.py | 2 |
16 files changed, 50 insertions, 47 deletions
diff --git a/Lib/ctypes/test/test_as_parameter.py b/Lib/ctypes/test/test_as_parameter.py index 948b463..2a3484b 100644 --- a/Lib/ctypes/test/test_as_parameter.py +++ b/Lib/ctypes/test/test_as_parameter.py @@ -194,7 +194,7 @@ class BasicWrapTestCase(unittest.TestCase): a = A() a._as_parameter_ = a - with self.assertRaises(RuntimeError): + with self.assertRaises(RecursionError): c_int.from_param(a) diff --git a/Lib/test/exception_hierarchy.txt b/Lib/test/exception_hierarchy.txt index 6632826..0513765 100644 --- a/Lib/test/exception_hierarchy.txt +++ b/Lib/test/exception_hierarchy.txt @@ -39,6 +39,7 @@ BaseException +-- ReferenceError +-- RuntimeError | +-- NotImplementedError + | +-- RecursionError +-- SyntaxError | +-- IndentationError | +-- TabError diff --git a/Lib/test/list_tests.py b/Lib/test/list_tests.py index 9069337..1adfc75 100644 --- a/Lib/test/list_tests.py +++ b/Lib/test/list_tests.py @@ -56,7 +56,7 @@ class CommonTest(seq_tests.CommonTest): l0 = [] for i in range(sys.getrecursionlimit() + 100): l0 = [l0] - self.assertRaises(RuntimeError, repr, l0) + self.assertRaises(RecursionError, repr, l0) def test_print(self): d = self.type2test(range(200)) diff --git a/Lib/test/test_class.py b/Lib/test/test_class.py index 6036e36..4d554a3 100644 --- a/Lib/test/test_class.py +++ b/Lib/test/test_class.py @@ -500,10 +500,10 @@ class ClassTests(unittest.TestCase): try: a() # This should not segfault - except RuntimeError: + except RecursionError: pass else: - self.fail("Failed to raise RuntimeError") + self.fail("Failed to raise RecursionError") def testForExceptionsRaisedInInstanceGetattr2(self): # Tests for exceptions raised in instance_getattr2(). diff --git a/Lib/test/test_compile.py b/Lib/test/test_compile.py index f5e4576..db821be 100644 --- a/Lib/test/test_compile.py +++ b/Lib/test/test_compile.py @@ -534,7 +534,7 @@ if 1: broken = prefix + repeated * fail_depth details = "Compiling ({!r} + {!r} * {})".format( prefix, repeated, fail_depth) - with self.assertRaises(RuntimeError, msg=details): + with self.assertRaises(RecursionError, msg=details): self.compile_single(broken) check_limit("a", "()") diff --git a/Lib/test/test_copy.py b/Lib/test/test_copy.py index 4c19746..b9eaddd 100644 --- a/Lib/test/test_copy.py +++ b/Lib/test/test_copy.py @@ -327,7 +327,7 @@ class TestCopy(unittest.TestCase): x.append(x) y = copy.deepcopy(x) for op in comparisons: - self.assertRaises(RuntimeError, op, y, x) + self.assertRaises(RecursionError, op, y, x) self.assertIsNot(y, x) self.assertIs(y[0], y) self.assertEqual(len(y), 1) @@ -354,7 +354,7 @@ class TestCopy(unittest.TestCase): x[0].append(x) y = copy.deepcopy(x) for op in comparisons: - self.assertRaises(RuntimeError, op, y, x) + self.assertRaises(RecursionError, op, y, x) self.assertIsNot(y, x) self.assertIsNot(y[0], x[0]) self.assertIs(y[0][0], y) @@ -373,7 +373,7 @@ class TestCopy(unittest.TestCase): for op in order_comparisons: self.assertRaises(TypeError, op, y, x) for op in equality_comparisons: - self.assertRaises(RuntimeError, op, y, x) + self.assertRaises(RecursionError, op, y, x) self.assertIsNot(y, x) self.assertIs(y['foo'], y) self.assertEqual(len(y), 1) diff --git a/Lib/test/test_descr.py b/Lib/test/test_descr.py index 80a526d..0ef1a31 100644 --- a/Lib/test/test_descr.py +++ b/Lib/test/test_descr.py @@ -3342,7 +3342,7 @@ order (MRO) for bases """ A.__call__ = A() try: A()() - except RuntimeError: + except RecursionError: pass else: self.fail("Recursion limit should have been reached for __call__()") @@ -4317,8 +4317,8 @@ order (MRO) for bases """ pass Foo.__repr__ = Foo.__str__ foo = Foo() - self.assertRaises(RuntimeError, str, foo) - self.assertRaises(RuntimeError, repr, foo) + self.assertRaises(RecursionError, str, foo) + self.assertRaises(RecursionError, repr, foo) def test_mixing_slot_wrappers(self): class X(dict): diff --git a/Lib/test/test_dictviews.py b/Lib/test/test_dictviews.py index 280353a..8d33801 100644 --- a/Lib/test/test_dictviews.py +++ b/Lib/test/test_dictviews.py @@ -195,7 +195,7 @@ class DictSetTest(unittest.TestCase): def test_recursive_repr(self): d = {} d[42] = d.values() - self.assertRaises(RuntimeError, repr, d) + self.assertRaises(RecursionError, repr, d) if __name__ == "__main__": diff --git a/Lib/test/test_exceptions.py b/Lib/test/test_exceptions.py index 80d4f1a..3bfb582 100644 --- a/Lib/test/test_exceptions.py +++ b/Lib/test/test_exceptions.py @@ -84,6 +84,7 @@ class ExceptionTests(unittest.TestCase): x += x # this simply shouldn't blow up self.raise_catch(RuntimeError, "RuntimeError") + self.raise_catch(RecursionError, "RecursionError") self.raise_catch(SyntaxError, "SyntaxError") try: exec('/\n') @@ -474,14 +475,14 @@ class ExceptionTests(unittest.TestCase): def testInfiniteRecursion(self): def f(): return f() - self.assertRaises(RuntimeError, f) + self.assertRaises(RecursionError, f) def g(): try: return g() except ValueError: return -1 - self.assertRaises(RuntimeError, g) + self.assertRaises(RecursionError, g) def test_str(self): # Make sure both instances and classes have a str representation. @@ -887,10 +888,10 @@ class ExceptionTests(unittest.TestCase): def g(): try: return g() - except RuntimeError: + except RecursionError: return sys.exc_info() e, v, tb = g() - self.assertTrue(isinstance(v, RuntimeError), type(v)) + self.assertTrue(isinstance(v, RecursionError), type(v)) self.assertIn("maximum recursion depth exceeded", str(v)) @@ -989,10 +990,10 @@ class ExceptionTests(unittest.TestCase): # We cannot use assertRaises since it manually deletes the traceback try: inner() - except RuntimeError as e: + except RecursionError as e: self.assertNotEqual(wr(), None) else: - self.fail("RuntimeError not raised") + self.fail("RecursionError not raised") self.assertEqual(wr(), None) def test_errno_ENOTDIR(self): diff --git a/Lib/test/test_isinstance.py b/Lib/test/test_isinstance.py index e087ac0..e63d59b 100644 --- a/Lib/test/test_isinstance.py +++ b/Lib/test/test_isinstance.py @@ -258,18 +258,18 @@ class TestIsInstanceIsSubclass(unittest.TestCase): self.assertEqual(True, issubclass(str, (str, (Child, NewChild, str)))) def test_subclass_recursion_limit(self): - # make sure that issubclass raises RuntimeError before the C stack is + # make sure that issubclass raises RecursionError before the C stack is # blown - self.assertRaises(RuntimeError, blowstack, issubclass, str, str) + self.assertRaises(RecursionError, blowstack, issubclass, str, str) def test_isinstance_recursion_limit(self): - # make sure that issubclass raises RuntimeError before the C stack is + # make sure that issubclass raises RecursionError before the C stack is # blown - self.assertRaises(RuntimeError, blowstack, isinstance, '', str) + self.assertRaises(RecursionError, blowstack, isinstance, '', str) def blowstack(fxn, arg, compare_to): # Make sure that calling isinstance with a deeply nested tuple for its - # argument will raise RuntimeError eventually. + # argument will raise RecursionError eventually. tuple_arg = (compare_to,) for cnt in range(sys.getrecursionlimit()+5): tuple_arg = (tuple_arg,) diff --git a/Lib/test/test_json/test_recursion.py b/Lib/test/test_json/test_recursion.py index 1a76254..877dc44 100644 --- a/Lib/test/test_json/test_recursion.py +++ b/Lib/test/test_json/test_recursion.py @@ -68,11 +68,11 @@ class TestRecursion: def test_highly_nested_objects_decoding(self): # test that loading highly-nested objects doesn't segfault when C # accelerations are used. See #12017 - with self.assertRaises(RuntimeError): + with self.assertRaises(RecursionError): self.loads('{"a":' * 100000 + '1' + '}' * 100000) - with self.assertRaises(RuntimeError): + with self.assertRaises(RecursionError): self.loads('{"a":' * 100000 + '[1]' + '}' * 100000) - with self.assertRaises(RuntimeError): + with self.assertRaises(RecursionError): self.loads('[' * 100000 + '1' + ']' * 100000) def test_highly_nested_objects_encoding(self): @@ -80,9 +80,9 @@ class TestRecursion: l, d = [], {} for x in range(100000): l, d = [l], {'k':d} - with self.assertRaises(RuntimeError): + with self.assertRaises(RecursionError): self.dumps(l) - with self.assertRaises(RuntimeError): + with self.assertRaises(RecursionError): self.dumps(d) def test_endless_recursion(self): @@ -92,7 +92,7 @@ class TestRecursion: """If check_circular is False, this will keep adding another list.""" return [o] - with self.assertRaises(RuntimeError): + with self.assertRaises(RecursionError): EndlessJSONEncoder(check_circular=False).encode(5j) diff --git a/Lib/test/test_pickle.py b/Lib/test/test_pickle.py index a9853c1..ba92de9 100644 --- a/Lib/test/test_pickle.py +++ b/Lib/test/test_pickle.py @@ -353,7 +353,8 @@ class CompatPickleTests(unittest.TestCase): with self.subTest(name): if exc in (BlockingIOError, ResourceWarning, - StopAsyncIteration): + StopAsyncIteration, + RecursionError): continue if exc is not OSError and issubclass(exc, OSError): self.assertEqual(reverse_mapping('builtins', name), diff --git a/Lib/test/test_richcmp.py b/Lib/test/test_richcmp.py index 94185a4..1582caa 100644 --- a/Lib/test/test_richcmp.py +++ b/Lib/test/test_richcmp.py @@ -228,25 +228,25 @@ class MiscTest(unittest.TestCase): b = UserList() a.append(b) b.append(a) - self.assertRaises(RuntimeError, operator.eq, a, b) - self.assertRaises(RuntimeError, operator.ne, a, b) - self.assertRaises(RuntimeError, operator.lt, a, b) - self.assertRaises(RuntimeError, operator.le, a, b) - self.assertRaises(RuntimeError, operator.gt, a, b) - self.assertRaises(RuntimeError, operator.ge, a, b) + self.assertRaises(RecursionError, operator.eq, a, b) + self.assertRaises(RecursionError, operator.ne, a, b) + self.assertRaises(RecursionError, operator.lt, a, b) + self.assertRaises(RecursionError, operator.le, a, b) + self.assertRaises(RecursionError, operator.gt, a, b) + self.assertRaises(RecursionError, operator.ge, a, b) b.append(17) # Even recursive lists of different lengths are different, # but they cannot be ordered self.assertTrue(not (a == b)) self.assertTrue(a != b) - self.assertRaises(RuntimeError, operator.lt, a, b) - self.assertRaises(RuntimeError, operator.le, a, b) - self.assertRaises(RuntimeError, operator.gt, a, b) - self.assertRaises(RuntimeError, operator.ge, a, b) + self.assertRaises(RecursionError, operator.lt, a, b) + self.assertRaises(RecursionError, operator.le, a, b) + self.assertRaises(RecursionError, operator.gt, a, b) + self.assertRaises(RecursionError, operator.ge, a, b) a.append(17) - self.assertRaises(RuntimeError, operator.eq, a, b) - self.assertRaises(RuntimeError, operator.ne, a, b) + self.assertRaises(RecursionError, operator.eq, a, b) + self.assertRaises(RecursionError, operator.ne, a, b) a.insert(0, 11) b.insert(0, 12) self.assertTrue(not (a == b)) diff --git a/Lib/test/test_runpy.py b/Lib/test/test_runpy.py index 5a799bd..4bae949 100644 --- a/Lib/test/test_runpy.py +++ b/Lib/test/test_runpy.py @@ -673,7 +673,7 @@ class RunPathTestCase(unittest.TestCase, CodeExecutionMixin): script_name = self._make_test_script(script_dir, mod_name, source) zip_name, fname = make_zip_script(script_dir, 'test_zip', script_name) msg = "recursion depth exceeded" - self.assertRaisesRegex(RuntimeError, msg, run_path, zip_name) + self.assertRaisesRegex(RecursionError, msg, run_path, zip_name) def test_encoding(self): with temp_dir() as script_dir: diff --git a/Lib/test/test_sys.py b/Lib/test/test_sys.py index 494a53b..83549bc 100644 --- a/Lib/test/test_sys.py +++ b/Lib/test/test_sys.py @@ -211,8 +211,8 @@ class SysModuleTest(unittest.TestCase): for i in (50, 1000): # Issue #5392: stack overflow after hitting recursion limit twice sys.setrecursionlimit(i) - self.assertRaises(RuntimeError, f) - self.assertRaises(RuntimeError, f) + self.assertRaises(RecursionError, f) + self.assertRaises(RecursionError, f) finally: sys.setrecursionlimit(oldlimit) @@ -225,7 +225,7 @@ class SysModuleTest(unittest.TestCase): def f(): try: f() - except RuntimeError: + except RecursionError: f() sys.setrecursionlimit(%d) diff --git a/Lib/test/test_threading.py b/Lib/test/test_threading.py index ddafba2..3b11bf6 100644 --- a/Lib/test/test_threading.py +++ b/Lib/test/test_threading.py @@ -945,7 +945,7 @@ class ThreadingExceptionTests(BaseTestCase): def outer(): try: recurse() - except RuntimeError: + except RecursionError: pass w = threading.Thread(target=outer) |