@@ -12,15 +12,8 @@ extern "C" {
12
12
struct pyruntimestate ;
13
13
struct _ceval_runtime_state ;
14
14
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. */
18
15
#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
24
17
#endif
25
18
26
19
#include "pycore_interp.h" // PyInterpreterState.eval_frame
@@ -118,19 +111,22 @@ extern void _PyEval_DeactivateOpCache(void);
118
111
/* With USE_STACKCHECK macro defined, trigger stack checks in
119
112
_Py_CheckRecursiveCall() on every 64th call to _Py_EnterRecursiveCall. */
120
113
static 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 );
123
116
}
124
117
#else
125
118
static inline int _Py_MakeRecCheck (PyThreadState * tstate ) {
126
- return tstate -> recursion_remaining -- <= 0 ;
119
+ return tstate -> c_recursion_remaining -- <= 0 ;
127
120
}
128
121
#endif
129
122
130
123
PyAPI_FUNC (int ) _Py_CheckRecursiveCall (
131
124
PyThreadState * tstate ,
132
125
const char * where );
133
126
127
+ int _Py_CheckRecursiveCallPy (
128
+ PyThreadState * tstate );
129
+
134
130
static inline int _Py_EnterRecursiveCallTstate (PyThreadState * tstate ,
135
131
const char * where ) {
136
132
return (_Py_MakeRecCheck (tstate ) && _Py_CheckRecursiveCall (tstate , where ));
@@ -142,7 +138,7 @@ static inline int _Py_EnterRecursiveCall(const char *where) {
142
138
}
143
139
144
140
static inline void _Py_LeaveRecursiveCallTstate (PyThreadState * tstate ) {
145
- tstate -> recursion_remaining ++ ;
141
+ tstate -> c_recursion_remaining ++ ;
146
142
}
147
143
148
144
static inline void _Py_LeaveRecursiveCall (void ) {
@@ -157,6 +153,7 @@ extern PyObject* _Py_MakeCoro(PyFunctionObject *func);
157
153
extern int _Py_HandlePending (PyThreadState * tstate );
158
154
159
155
156
+
160
157
#ifdef __cplusplus
161
158
}
162
159
#endif
0 commit comments