summaryrefslogtreecommitdiffstats
path: root/contrib/tools/python3/Include/cpython/pystate.h
diff options
context:
space:
mode:
authorshadchin <[email protected]>2024-04-28 21:17:44 +0300
committershadchin <[email protected]>2024-04-28 21:25:54 +0300
commita55d99a3eb72f90355bc146baeda18aa7eb97352 (patch)
treeb17cfed786effe8b81bba022239d6729f716fbeb /contrib/tools/python3/Include/cpython/pystate.h
parent67bf49d08acf1277eff4c336021ac22d964bb4c4 (diff)
Update Python 3 to 3.12.3
7d09de7d8b99ea2be554ef0fc61276942ca9c2e1
Diffstat (limited to 'contrib/tools/python3/Include/cpython/pystate.h')
-rw-r--r--contrib/tools/python3/Include/cpython/pystate.h20
1 files changed, 16 insertions, 4 deletions
diff --git a/contrib/tools/python3/Include/cpython/pystate.h b/contrib/tools/python3/Include/cpython/pystate.h
index 628f2e0996e..32789e17bda 100644
--- a/contrib/tools/python3/Include/cpython/pystate.h
+++ b/contrib/tools/python3/Include/cpython/pystate.h
@@ -251,13 +251,25 @@ struct _ts {
/* 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. */
-#ifndef C_RECURSION_LIMIT
-# ifdef __wasi__
-# define C_RECURSION_LIMIT 500
+#ifdef Py_DEBUG
+# if defined(__wasi__)
+# define C_RECURSION_LIMIT 150
# else
- // This value is duplicated in Lib/test/support/__init__.py
# define C_RECURSION_LIMIT 1500
# endif
+#else
+# if defined(__wasi__)
+# define C_RECURSION_LIMIT 500
+# elif defined(__s390x__)
+# define C_RECURSION_LIMIT 800
+# elif defined(_WIN32)
+# define C_RECURSION_LIMIT 3000
+# elif defined(_Py_ADDRESS_SANITIZER)
+# define C_RECURSION_LIMIT 4000
+# else
+ // This value is duplicated in Lib/test/support/__init__.py
+# define C_RECURSION_LIMIT 10000
+# endif
#endif
/* other API */