diff options
author | Brett Cannon <brett@python.org> | 2024-01-23 23:48:14 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-23 23:48:14 (GMT) |
commit | f59f90b5bccb9e7ac522bc779ab1f6bf11bb4aa3 (patch) | |
tree | 83782c1796acc78abfc39e30c0c41ec1e1101f18 /Include | |
parent | afe8f376c096d5d6e8b12fbc691ca9b35381470b (diff) | |
download | cpython-f59f90b5bccb9e7ac522bc779ab1f6bf11bb4aa3.zip cpython-f59f90b5bccb9e7ac522bc779ab1f6bf11bb4aa3.tar.gz cpython-f59f90b5bccb9e7ac522bc779ab1f6bf11bb4aa3.tar.bz2 |
GH-114456: lower the recursion limit under WASI for debug builds (GH-114457)
Testing under wasmtime 16.0.0 w/ code from https://github.com/python/cpython/issues/114413 is how the value was found.
Diffstat (limited to 'Include')
-rw-r--r-- | Include/cpython/pystate.h | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/Include/cpython/pystate.h b/Include/cpython/pystate.h index 60b056b..1dbf976 100644 --- a/Include/cpython/pystate.h +++ b/Include/cpython/pystate.h @@ -217,11 +217,14 @@ struct _ts { #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 +# if defined(__wasi__) + // Based on wasmtime 16. +# define Py_C_RECURSION_LIMIT 150 +# else +# define Py_C_RECURSION_LIMIT 500 +# endif #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. + // Based on wasmtime 16. # define Py_C_RECURSION_LIMIT 500 #elif defined(__s390x__) # define Py_C_RECURSION_LIMIT 800 |