mirror of
https://github.com/python/cpython.git
synced 2025-12-31 04:23:37 +00:00
gh-111798: Use lower Py_C_RECURSION_LIMIT in debug mode (#112124)
* Run again test_ast_recursion_limit() on WASI platform. * Add _testinternalcapi.get_c_recursion_remaining(). * Fix test_ast and test_sys_settrace: test_ast_recursion_limit() and test_trace_unpack_long_sequence() now adjust the maximum recursion depth depending on the the remaining C recursion.
This commit is contained in:
parent
81ab0e8a4a
commit
bd89bca9e2
5 changed files with 37 additions and 5 deletions
|
|
@ -214,7 +214,11 @@ struct _ts {
|
|||
|
||||
};
|
||||
|
||||
#ifdef __wasi__
|
||||
#ifdef Py_DEBUG
|
||||
// A debug build is likely built with low optimization level which implies
|
||||
// higher stack memory usage than a release build: use a lower limit.
|
||||
# define Py_C_RECURSION_LIMIT 500
|
||||
#elif defined(__wasi__)
|
||||
// WASI has limited call stack. Python's recursion limit depends on code
|
||||
// layout, optimization, and WASI runtime. Wasmtime can handle about 700
|
||||
// recursions, sometimes less. 500 is a more conservative limit.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue