diff options
author | Christian Heimes <christian@python.org> | 2022-07-26 20:14:35 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-26 20:14:35 (GMT) |
commit | 51c56f8d7242e98d5d6a3c7a7c51fe40f3da4512 (patch) | |
tree | 37190fd9cb68624dada775b5e165ff836ef1efad /Lib/test/test_dynamic.py | |
parent | 9af7f87d763ed6e1c5f56ae40d8242ab22866b33 (diff) | |
download | cpython-51c56f8d7242e98d5d6a3c7a7c51fe40f3da4512.zip cpython-51c56f8d7242e98d5d6a3c7a7c51fe40f3da4512.tar.gz cpython-51c56f8d7242e98d5d6a3c7a7c51fe40f3da4512.tar.bz2 |
gh-93678: Address stack exhaustion on WASI (GH-95296)
Diffstat (limited to 'Lib/test/test_dynamic.py')
-rw-r--r-- | Lib/test/test_dynamic.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/Lib/test/test_dynamic.py b/Lib/test/test_dynamic.py index 3e0fcf4..e896fc7 100644 --- a/Lib/test/test_dynamic.py +++ b/Lib/test/test_dynamic.py @@ -1,6 +1,7 @@ # Test the most dynamic corner cases of Python's runtime semantics. import builtins +import sys import unittest from test.support import swap_item, swap_attr @@ -139,12 +140,14 @@ class RebindBuiltinsTests(unittest.TestCase): def __missing__(self, key): return int(key.removeprefix("_number_")) - code = "lambda: " + "+".join(f"_number_{i}" for i in range(1000)) - sum_1000 = eval(code, MyGlobals()) - expected = sum(range(1000)) + # 1,000 on most systems + limit = sys.getrecursionlimit() + code = "lambda: " + "+".join(f"_number_{i}" for i in range(limit)) + sum_func = eval(code, MyGlobals()) + expected = sum(range(limit)) # Warm up the the function for quickening (PEP 659) for _ in range(30): - self.assertEqual(sum_1000(), expected) + self.assertEqual(sum_func(), expected) if __name__ == "__main__": unittest.main() |