mirror of
https://github.com/python/cpython.git
synced 2025-07-29 06:05:00 +00:00
gh-90473: Reduce recursion limit on WASI even further (GH-94333)
750 fails sometimes with newer wasmtime versions. 600 is a more conservative value.
This commit is contained in:
parent
c0453a40fa
commit
e5e51556e4
2 changed files with 6 additions and 5 deletions
|
@ -12,11 +12,12 @@ extern "C" {
|
||||||
struct pyruntimestate;
|
struct pyruntimestate;
|
||||||
struct _ceval_runtime_state;
|
struct _ceval_runtime_state;
|
||||||
|
|
||||||
/* WASI has limited call stack. wasmtime 0.36 can handle sufficient amount of
|
/* WASI has limited call stack. Python's recursion limit depends on code
|
||||||
C stack frames for little more than 750 recursions. */
|
layout, optimization, and WASI runtime. Wasmtime can handle about 700-750
|
||||||
|
recursions, sometimes less. 600 is a more conservative limit. */
|
||||||
#ifndef Py_DEFAULT_RECURSION_LIMIT
|
#ifndef Py_DEFAULT_RECURSION_LIMIT
|
||||||
# ifdef __wasi__
|
# ifdef __wasi__
|
||||||
# define Py_DEFAULT_RECURSION_LIMIT 750
|
# define Py_DEFAULT_RECURSION_LIMIT 600
|
||||||
# else
|
# else
|
||||||
# define Py_DEFAULT_RECURSION_LIMIT 1000
|
# define Py_DEFAULT_RECURSION_LIMIT 1000
|
||||||
# endif
|
# endif
|
||||||
|
|
|
@ -92,8 +92,8 @@ class TestMiscellaneous(unittest.TestCase):
|
||||||
self.assertEqual(obj_copy, expected_obj)
|
self.assertEqual(obj_copy, expected_obj)
|
||||||
|
|
||||||
def test_inline_array_recursion_limit(self):
|
def test_inline_array_recursion_limit(self):
|
||||||
# 470 with default recursion limit
|
# 465 with default recursion limit
|
||||||
nest_count = int(sys.getrecursionlimit() * 0.47)
|
nest_count = int(sys.getrecursionlimit() * 0.465)
|
||||||
recursive_array_toml = "arr = " + nest_count * "[" + nest_count * "]"
|
recursive_array_toml = "arr = " + nest_count * "[" + nest_count * "]"
|
||||||
tomllib.loads(recursive_array_toml)
|
tomllib.loads(recursive_array_toml)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue