MCPcopy Index your code
hub / github.com/python/cpython / test_super_deep

Method test_super_deep

Lib/test/test_call.py:1067–1096  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1065 @skip_emscripten_stack_overflow()
1066 @skip_wasi_stack_overflow()
1067 def test_super_deep(self):
1068
1069 def recurse(n):
1070 if n:
1071 recurse(n-1)
1072
1073 def py_recurse(n, m):
1074 if n:
1075 py_recurse(n-1, m)
1076 else:
1077 c_py_recurse(m-1)
1078
1079 def c_recurse(n):
1080 if n:
1081 _testcapi.pyobject_vectorcall(c_recurse, (n-1,), ())
1082
1083 def c_py_recurse(m):
1084 if m:
1085 _testcapi.pyobject_vectorcall(py_recurse, (1000, m), ())
1086
1087 with set_recursion_limit(100_000):
1088 recurse(90_000)
1089 with self.assertRaises(RecursionError):
1090 recurse(101_000)
1091 c_recurse(50)
1092 with self.assertRaises(RecursionError):
1093 c_recurse(90_000)
1094 c_py_recurse(50)
1095 with self.assertRaises(RecursionError):
1096 c_py_recurse(100_000)
1097
1098 def test_recursion_with_kwargs(self):
1099 # GH-137883: The interpreter forgot to check the recursion limit when

Callers

nothing calls this directly

Calls 2

set_recursion_limitFunction · 0.90
assertRaisesMethod · 0.45

Tested by

no test coverage detected