@@ -12,15 +12,8 @@ extern "C" {
1212struct pyruntimestate ;
1313struct _ceval_runtime_state ;
1414
15- /* WASI has limited call stack. Python's recursion limit depends on code
16- layout, optimization, and WASI runtime. Wasmtime can handle about 700-750
17- recursions, sometimes less. 600 is a more conservative limit. */
1815#ifndef Py_DEFAULT_RECURSION_LIMIT
19- # ifdef __wasi__
20- # define Py_DEFAULT_RECURSION_LIMIT 600
21- # else
22- # define Py_DEFAULT_RECURSION_LIMIT 1000
23- # endif
16+ # define Py_DEFAULT_RECURSION_LIMIT 1000
2417#endif
2518
2619#include "pycore_interp.h" // PyInterpreterState.eval_frame
@@ -118,19 +111,22 @@ extern void _PyEval_DeactivateOpCache(void);
118111/* With USE_STACKCHECK macro defined, trigger stack checks in
119112 _Py_CheckRecursiveCall() on every 64th call to _Py_EnterRecursiveCall. */
120113static inline int _Py_MakeRecCheck (PyThreadState * tstate ) {
121- return (tstate -> recursion_remaining -- <= 0
122- || (tstate -> recursion_remaining & 63 ) == 0 );
114+ return (tstate -> c_recursion_remaining -- <= 0
115+ || (tstate -> c_recursion_remaining & 63 ) == 0 );
123116}
124117#else
125118static inline int _Py_MakeRecCheck (PyThreadState * tstate ) {
126- return tstate -> recursion_remaining -- <= 0 ;
119+ return tstate -> c_recursion_remaining -- <= 0 ;
127120}
128121#endif
129122
130123PyAPI_FUNC (int ) _Py_CheckRecursiveCall (
131124 PyThreadState * tstate ,
132125 const char * where );
133126
127+ int _Py_CheckRecursiveCallPy (
128+ PyThreadState * tstate );
129+
134130static inline int _Py_EnterRecursiveCallTstate (PyThreadState * tstate ,
135131 const char * where ) {
136132 return (_Py_MakeRecCheck (tstate ) && _Py_CheckRecursiveCall (tstate , where ));
@@ -142,7 +138,7 @@ static inline int _Py_EnterRecursiveCall(const char *where) {
142138}
143139
144140static inline void _Py_LeaveRecursiveCallTstate (PyThreadState * tstate ) {
145- tstate -> recursion_remaining ++ ;
141+ tstate -> c_recursion_remaining ++ ;
146142}
147143
148144static inline void _Py_LeaveRecursiveCall (void ) {
@@ -157,6 +153,7 @@ extern PyObject* _Py_MakeCoro(PyFunctionObject *func);
157153extern int _Py_HandlePending (PyThreadState * tstate );
158154
159155
156+
160157#ifdef __cplusplus
161158}
162159#endif
0 commit comments