@@ -214,31 +214,24 @@ struct _ts {
214
214
215
215
};
216
216
217
-
218
- #if defined(__has_feature ) /* Clang */
219
- # if __has_feature (address_sanitizer ) /* is ASAN enabled? */
220
- # define Py_C_RECURSION_LIMIT 5000
221
- # endif
222
- #endif
223
-
224
- #ifndef Py_C_RECURSION_LIMIT
225
- # ifdef Py_DEBUG
226
- // A debug build is likely built with low optimization level which implies
227
- // higher stack memory usage than a release build: use a lower limit.
228
- # define Py_C_RECURSION_LIMIT 500
229
- # elif defined(__wasi__ )
230
- // WASI has limited call stack. Python's recursion limit depends on code
231
- // layout, optimization, and WASI runtime. Wasmtime can handle about 700
232
- // recursions, sometimes less. 500 is a more conservative limit.
233
- # define Py_C_RECURSION_LIMIT 500
234
- # elif defined(__s390x__ )
235
- # define Py_C_RECURSION_LIMIT 1200
236
- # elif defined(_WIN32 )
237
- # define Py_C_RECURSION_LIMIT 4000
238
- # else
239
- // This value is duplicated in Lib/test/support/__init__.py
240
- # define Py_C_RECURSION_LIMIT 10000
241
- # endif
217
+ #ifdef Py_DEBUG
218
+ // A debug build is likely built with low optimization level which implies
219
+ // higher stack memory usage than a release build: use a lower limit.
220
+ # define Py_C_RECURSION_LIMIT 500
221
+ #elif defined(__wasi__ )
222
+ // WASI has limited call stack. Python's recursion limit depends on code
223
+ // layout, optimization, and WASI runtime. Wasmtime can handle about 700
224
+ // recursions, sometimes less. 500 is a more conservative limit.
225
+ # define Py_C_RECURSION_LIMIT 500
226
+ #elif defined(__s390x__ )
227
+ # define Py_C_RECURSION_LIMIT 1200
228
+ #elif defined(_WIN32 )
229
+ # define Py_C_RECURSION_LIMIT 4000
230
+ #elif defined(_Py_ADDRESS_SANITIZER )
231
+ # define Py_C_RECURSION_LIMIT 7000
232
+ #else
233
+ // This value is duplicated in Lib/test/support/__init__.py
234
+ # define Py_C_RECURSION_LIMIT 10000
242
235
#endif
243
236
244
237
0 commit comments