mirror of
https://github.com/python/cpython.git
synced 2025-10-09 16:34:44 +00:00
GH-91079: Decouple C stack overflow checks from Python recursion checks. (GH-96510)
This commit is contained in:
parent
0ff8fd6583
commit
76449350b3
22 changed files with 165 additions and 99 deletions
|
@ -1372,6 +1372,7 @@ class ExceptionTests(unittest.TestCase):
|
|||
code = """if 1:
|
||||
import sys
|
||||
from _testinternalcapi import get_recursion_depth
|
||||
from test import support
|
||||
|
||||
class MyException(Exception): pass
|
||||
|
||||
|
@ -1399,13 +1400,8 @@ class ExceptionTests(unittest.TestCase):
|
|||
generator = gen()
|
||||
next(generator)
|
||||
recursionlimit = sys.getrecursionlimit()
|
||||
depth = get_recursion_depth()
|
||||
try:
|
||||
# Upon the last recursive invocation of recurse(),
|
||||
# tstate->recursion_depth is equal to (recursion_limit - 1)
|
||||
# and is equal to recursion_limit when _gen_throw() calls
|
||||
# PyErr_NormalizeException().
|
||||
recurse(setrecursionlimit(depth + 2) - depth)
|
||||
recurse(support.EXCEEDS_RECURSION_LIMIT)
|
||||
finally:
|
||||
sys.setrecursionlimit(recursionlimit)
|
||||
print('Done.')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue