mirror of
https://github.com/python/cpython.git
synced 2025-08-03 00:23:06 +00:00
[3.11] gh-98925: Lower marshal recursion depth for WASI (GH-98938) (GH-98979)
* gh-98925: Lower marshal recursion depth for WASI (GH-98938)
For wasmtime 2.0, the stack depth cost is 6% higher. This causes the default max `marshal` recursion depth to blow the stack.
As the default marshal depth is 2000 and Windows is set to 1000, split the difference and choose 1500 for WASI to be safe.
(cherry picked from commit 9711265182
)
Co-authored-by: Brett Cannon <brett@python.org>
This commit is contained in:
parent
cd6655a858
commit
39e0627b77
4 changed files with 7 additions and 0 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -114,6 +114,7 @@ PCbuild/win32/
|
||||||
Tools/unicode/data/
|
Tools/unicode/data/
|
||||||
/autom4te.cache
|
/autom4te.cache
|
||||||
/build/
|
/build/
|
||||||
|
/builddir/
|
||||||
/config.cache
|
/config.cache
|
||||||
/config.log
|
/config.log
|
||||||
/config.status
|
/config.status
|
||||||
|
|
|
@ -259,6 +259,8 @@ class BugsTestCase(unittest.TestCase):
|
||||||
#if os.name == 'nt' and hasattr(sys, 'gettotalrefcount'):
|
#if os.name == 'nt' and hasattr(sys, 'gettotalrefcount'):
|
||||||
if os.name == 'nt':
|
if os.name == 'nt':
|
||||||
MAX_MARSHAL_STACK_DEPTH = 1000
|
MAX_MARSHAL_STACK_DEPTH = 1000
|
||||||
|
elif sys.platform == 'wasi':
|
||||||
|
MAX_MARSHAL_STACK_DEPTH = 1500
|
||||||
else:
|
else:
|
||||||
MAX_MARSHAL_STACK_DEPTH = 2000
|
MAX_MARSHAL_STACK_DEPTH = 2000
|
||||||
for i in range(MAX_MARSHAL_STACK_DEPTH - 2):
|
for i in range(MAX_MARSHAL_STACK_DEPTH - 2):
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
Lower the recursion depth for marshal on WASI to support
|
||||||
|
wasmtime 2.0/main.
|
|
@ -34,6 +34,8 @@ module marshal
|
||||||
*/
|
*/
|
||||||
#if defined(MS_WINDOWS)
|
#if defined(MS_WINDOWS)
|
||||||
#define MAX_MARSHAL_STACK_DEPTH 1000
|
#define MAX_MARSHAL_STACK_DEPTH 1000
|
||||||
|
#elif defined(__wasi__)
|
||||||
|
#define MAX_MARSHAL_STACK_DEPTH 1500
|
||||||
#else
|
#else
|
||||||
#define MAX_MARSHAL_STACK_DEPTH 2000
|
#define MAX_MARSHAL_STACK_DEPTH 2000
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue