bpo-41936. Remove macros Py_ALLOW_RECURSION/Py_END_ALLOW_RECURSION (GH-22552)
This commit is contained in:
parent
9a7642667a
commit
dcc54215ac
|
@ -365,3 +365,8 @@ Removed
|
||||||
* Removed ``_Py_CheckRecursionLimit`` variable: it has been replaced by
|
* Removed ``_Py_CheckRecursionLimit`` variable: it has been replaced by
|
||||||
``ceval.recursion_limit`` of the :c:type:`PyInterpreterState` structure.
|
``ceval.recursion_limit`` of the :c:type:`PyInterpreterState` structure.
|
||||||
(Contributed by Victor Stinner in :issue:`41834`.)
|
(Contributed by Victor Stinner in :issue:`41834`.)
|
||||||
|
|
||||||
|
* Removed undocumented macros ``Py_ALLOW_RECURSION`` and
|
||||||
|
``Py_END_ALLOW_RECURSION`` and the ``recursion_critical`` field of the
|
||||||
|
:c:type:`PyInterpreterState` structure.
|
||||||
|
(Contributed by Serhiy Storchaka in :issue:`41936`.)
|
||||||
|
|
|
@ -67,14 +67,6 @@ PyAPI_FUNC(int) Py_GetRecursionLimit(void);
|
||||||
PyAPI_FUNC(int) Py_EnterRecursiveCall(const char *where);
|
PyAPI_FUNC(int) Py_EnterRecursiveCall(const char *where);
|
||||||
PyAPI_FUNC(void) Py_LeaveRecursiveCall(void);
|
PyAPI_FUNC(void) Py_LeaveRecursiveCall(void);
|
||||||
|
|
||||||
#define Py_ALLOW_RECURSION \
|
|
||||||
do { unsigned char _old = PyThreadState_GET()->recursion_critical;\
|
|
||||||
PyThreadState_GET()->recursion_critical = 1;
|
|
||||||
|
|
||||||
#define Py_END_ALLOW_RECURSION \
|
|
||||||
PyThreadState_GET()->recursion_critical = _old; \
|
|
||||||
} while(0);
|
|
||||||
|
|
||||||
PyAPI_FUNC(const char *) PyEval_GetFuncName(PyObject *);
|
PyAPI_FUNC(const char *) PyEval_GetFuncName(PyObject *);
|
||||||
PyAPI_FUNC(const char *) PyEval_GetFuncDesc(PyObject *);
|
PyAPI_FUNC(const char *) PyEval_GetFuncDesc(PyObject *);
|
||||||
|
|
||||||
|
|
|
@ -56,8 +56,6 @@ struct _ts {
|
||||||
int recursion_depth;
|
int recursion_depth;
|
||||||
char overflowed; /* The stack has overflowed. Allow 50 more calls
|
char overflowed; /* The stack has overflowed. Allow 50 more calls
|
||||||
to handle the runtime error. */
|
to handle the runtime error. */
|
||||||
char recursion_critical; /* The current calls must not cause
|
|
||||||
a stack overflow. */
|
|
||||||
int stackcheck_counter;
|
int stackcheck_counter;
|
||||||
|
|
||||||
/* 'tracing' keeps track of the execution depth when tracing/profiling.
|
/* 'tracing' keeps track of the execution depth when tracing/profiling.
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
Removed undocumented macros ``Py_ALLOW_RECURSION`` and
|
||||||
|
``Py_END_ALLOW_RECURSION`` and the ``recursion_critical`` field of the
|
||||||
|
:c:type:`PyInterpreterState` structure.
|
|
@ -814,9 +814,6 @@ _Py_CheckRecursiveCall(PyThreadState *tstate, const char *where)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (tstate->recursion_critical)
|
|
||||||
/* Somebody asked that we don't check for recursion. */
|
|
||||||
return 0;
|
|
||||||
if (tstate->overflowed) {
|
if (tstate->overflowed) {
|
||||||
if (tstate->recursion_depth > recursion_limit + 50) {
|
if (tstate->recursion_depth > recursion_limit + 50) {
|
||||||
/* Overflowing while handling an overflow. Give up. */
|
/* Overflowing while handling an overflow. Give up. */
|
||||||
|
|
|
@ -581,7 +581,6 @@ new_threadstate(PyInterpreterState *interp, int init)
|
||||||
tstate->frame = NULL;
|
tstate->frame = NULL;
|
||||||
tstate->recursion_depth = 0;
|
tstate->recursion_depth = 0;
|
||||||
tstate->overflowed = 0;
|
tstate->overflowed = 0;
|
||||||
tstate->recursion_critical = 0;
|
|
||||||
tstate->stackcheck_counter = 0;
|
tstate->stackcheck_counter = 0;
|
||||||
tstate->tracing = 0;
|
tstate->tracing = 0;
|
||||||
tstate->use_tracing = 0;
|
tstate->use_tracing = 0;
|
||||||
|
|
Loading…
Reference in New Issue