aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Lib/test/test_isinstance.py
diff options
context:
space:
mode:
authorPetr Viktorin <encukou@gmail.com>2025-02-24 11:16:08 +0100
committerGitHub <noreply@github.com>2025-02-24 11:16:08 +0100
commitef29104f7d7ad7864f5f153cd7391af73d7cef63 (patch)
tree38c76b08e114a9e6e993081b828b64978bfefa2e /Lib/test/test_isinstance.py
parent0ff16115741aeaaaf7f963f68d5c575efb960277 (diff)
downloadcpython-ef29104f7d7ad7864f5f153cd7391af73d7cef63.tar.gz
cpython-ef29104f7d7ad7864f5f153cd7391af73d7cef63.zip
GH-91079: Revert "GH-91079: Implement C stack limits using addresses, not counters. (GH-130007)" for now (GH130413)
Revert "GH-91079: Implement C stack limits using addresses, not counters. (GH-130007)" for now Unfortunatlely, the change broke some buildbots. This reverts commit 2498c22fa0a2b560491bc503fa676585c1a603d0.
Diffstat (limited to 'Lib/test/test_isinstance.py')
-rw-r--r--Lib/test/test_isinstance.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/Lib/test/test_isinstance.py b/Lib/test/test_isinstance.py
index 115e26c5541..abc75c82375 100644
--- a/Lib/test/test_isinstance.py
+++ b/Lib/test/test_isinstance.py
@@ -267,13 +267,15 @@ class TestIsInstanceIsSubclass(unittest.TestCase):
def test_subclass_recursion_limit(self):
# make sure that issubclass raises RecursionError before the C stack is
# blown
- self.assertRaises(RecursionError, blowstack, issubclass, str, str)
+ with support.infinite_recursion():
+ self.assertRaises(RecursionError, blowstack, issubclass, str, str)
@support.skip_emscripten_stack_overflow()
def test_isinstance_recursion_limit(self):
# make sure that issubclass raises RecursionError before the C stack is
# blown
- self.assertRaises(RecursionError, blowstack, isinstance, '', str)
+ with support.infinite_recursion():
+ self.assertRaises(RecursionError, blowstack, isinstance, '', str)
def test_subclass_with_union(self):
self.assertTrue(issubclass(int, int | float | int))
@@ -353,9 +355,8 @@ def blowstack(fxn, arg, compare_to):
# Make sure that calling isinstance with a deeply nested tuple for its
# argument will raise RecursionError eventually.
tuple_arg = (compare_to,)
- while True:
- for _ in range(100):
- tuple_arg = (tuple_arg,)
+ for cnt in range(support.exceeds_recursion_limit()):
+ tuple_arg = (tuple_arg,)
fxn(arg, tuple_arg)