| OLD | NEW |
| 1 #ifndef Py_CEVAL_H | 1 #ifndef Py_CEVAL_H |
| 2 #define Py_CEVAL_H | 2 #define Py_CEVAL_H |
| 3 #ifdef __cplusplus | 3 #ifdef __cplusplus |
| 4 extern "C" { | 4 extern "C" { |
| 5 #endif | 5 #endif |
| 6 | 6 |
| 7 | 7 |
| 8 /* Interface to random parts in ceval.c */ | 8 /* Interface to random parts in ceval.c */ |
| 9 | 9 |
| 10 PyAPI_FUNC(PyObject *) PyEval_CallObjectWithKeywords( | 10 PyAPI_FUNC(PyObject *) PyEval_CallObjectWithKeywords( |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 flag was set, else return 0. */ | 39 flag was set, else return 0. */ |
| 40 PyAPI_FUNC(int) PyEval_MergeCompilerFlags(PyCompilerFlags *cf); | 40 PyAPI_FUNC(int) PyEval_MergeCompilerFlags(PyCompilerFlags *cf); |
| 41 | 41 |
| 42 PyAPI_FUNC(int) Py_AddPendingCall(int (*func)(void *), void *arg); | 42 PyAPI_FUNC(int) Py_AddPendingCall(int (*func)(void *), void *arg); |
| 43 PyAPI_FUNC(int) Py_MakePendingCalls(void); | 43 PyAPI_FUNC(int) Py_MakePendingCalls(void); |
| 44 | 44 |
| 45 /* Protection against deeply nested recursive calls */ | 45 /* Protection against deeply nested recursive calls */ |
| 46 PyAPI_FUNC(void) Py_SetRecursionLimit(int); | 46 PyAPI_FUNC(void) Py_SetRecursionLimit(int); |
| 47 PyAPI_FUNC(int) Py_GetRecursionLimit(void); | 47 PyAPI_FUNC(int) Py_GetRecursionLimit(void); |
| 48 | 48 |
| 49 #define Py_EnterRecursiveCall(where) \ | 49 #define Py_EnterRecursiveCall(where) \ |
| 50 (_Py_MakeRecCheck(PyThreadState_GET()->recursion_depth) && \ | 50 (_Py_MakeRecCheck(PyThreadState_GET()->recursion_depth) && \ |
| 51 _Py_CheckRecursiveCall(where)) | 51 _Py_CheckRecursiveCall(where)) |
| 52 #define Py_LeaveRecursiveCall() \ | 52 #define Py_LeaveRecursiveCall() \ |
| 53 do{ if((--PyThreadState_GET()->recursion_depth) < \ | 53 do{ if(_Py_MakeEndRecCheck(PyThreadState_GET()->recursion_depth)) \ |
| 54 » _Py_CheckRecursionLimit - 50) \ | 54 » PyThreadState_GET()->overflowed = 0; \ |
| 55 » PyThreadState_GET()->overflowed = 0; \ | 55 » } while(0) |
| 56 } while(0) | |
| 57 PyAPI_FUNC(int) _Py_CheckRecursiveCall(char *where); | 56 PyAPI_FUNC(int) _Py_CheckRecursiveCall(char *where); |
| 58 PyAPI_DATA(int) _Py_CheckRecursionLimit; | 57 PyAPI_DATA(int) _Py_CheckRecursionLimit; |
| 58 |
| 59 #ifdef USE_STACKCHECK | 59 #ifdef USE_STACKCHECK |
| 60 # define _Py_MakeRecCheck(x) (++(x) > --_Py_CheckRecursionLimit) | 60 /* With USE_STACKCHECK, we artificially decrement the recursion limit in order |
| 61 to trigger regular stack checks in _Py_CheckRecursiveCall(), except if |
| 62 the "overflowed" flag is set, in which case we need the true value |
| 63 of _Py_CheckRecursionLimit for _Py_MakeEndRecCheck() to function properly. |
| 64 */ |
| 65 # define _Py_MakeRecCheck(x) \ |
| 66 » (++(x) > (_Py_CheckRecursionLimit += PyThreadState_GET()->overflowed - 1
)) |
| 61 #else | 67 #else |
| 62 # define _Py_MakeRecCheck(x) (++(x) > _Py_CheckRecursionLimit) | 68 # define _Py_MakeRecCheck(x) (++(x) > _Py_CheckRecursionLimit) |
| 69 #endif |
| 70 |
| 71 #ifdef USE_STACKCHECK |
| 72 # define _Py_MakeEndRecCheck(x) (--(x) < _Py_CheckRecursionLimit - 50) |
| 73 #else |
| 74 # define _Py_MakeEndRecCheck(x) (--(x) < _Py_CheckRecursionLimit - 50) |
| 63 #endif | 75 #endif |
| 64 | 76 |
| 65 #define Py_ALLOW_RECURSION \ | 77 #define Py_ALLOW_RECURSION \ |
| 66 do { unsigned char _old = PyThreadState_GET()->recursion_critical;\ | 78 do { unsigned char _old = PyThreadState_GET()->recursion_critical;\ |
| 67 PyThreadState_GET()->recursion_critical = 1; | 79 PyThreadState_GET()->recursion_critical = 1; |
| 68 | 80 |
| 69 #define Py_END_ALLOW_RECURSION \ | 81 #define Py_END_ALLOW_RECURSION \ |
| 70 PyThreadState_GET()->recursion_critical = _old; \ | 82 PyThreadState_GET()->recursion_critical = _old; \ |
| 71 } while(0); | 83 } while(0); |
| 72 | 84 |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 | 168 |
| 157 #endif /* !WITH_THREAD */ | 169 #endif /* !WITH_THREAD */ |
| 158 | 170 |
| 159 PyAPI_FUNC(int) _PyEval_SliceIndex(PyObject *, Py_ssize_t *); | 171 PyAPI_FUNC(int) _PyEval_SliceIndex(PyObject *, Py_ssize_t *); |
| 160 | 172 |
| 161 | 173 |
| 162 #ifdef __cplusplus | 174 #ifdef __cplusplus |
| 163 } | 175 } |
| 164 #endif | 176 #endif |
| 165 #endif /* !Py_CEVAL_H */ | 177 #endif /* !Py_CEVAL_H */ |
| OLD | NEW |