summaryrefslogtreecommitdiffstats
path: root/Include/ceval.h
diff options
context:
space:
mode:
authorArmin Rigo <arigo@tunes.org>2003-10-28 12:05:48 (GMT)
committerArmin Rigo <arigo@tunes.org>2003-10-28 12:05:48 (GMT)
commit2b3eb4062c5e50abf854f7e68038243ca7c07217 (patch)
treefc5a73861c6e4feb4f4bc497165fa28d9c81d79f /Include/ceval.h
parent0e4f76405d79e95abfdda21b9dfc10c7f32340e8 (diff)
downloadcpython-2b3eb4062c5e50abf854f7e68038243ca7c07217.zip
cpython-2b3eb4062c5e50abf854f7e68038243ca7c07217.tar.gz
cpython-2b3eb4062c5e50abf854f7e68038243ca7c07217.tar.bz2
Deleting cyclic object comparison.
SF patch 825639 http://mail.python.org/pipermail/python-dev/2003-October/039445.html
Diffstat (limited to 'Include/ceval.h')
-rw-r--r--Include/ceval.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/Include/ceval.h b/Include/ceval.h
index 411cf3e..dc3864b 100644
--- a/Include/ceval.h
+++ b/Include/ceval.h
@@ -43,9 +43,23 @@ PyAPI_FUNC(int) Py_FlushLine(void);
PyAPI_FUNC(int) Py_AddPendingCall(int (*func)(void *), void *arg);
PyAPI_FUNC(int) Py_MakePendingCalls(void);
+/* Protection against deeply nested recursive calls */
PyAPI_FUNC(void) Py_SetRecursionLimit(int);
PyAPI_FUNC(int) Py_GetRecursionLimit(void);
+#define Py_EnterRecursiveCall(where) \
+ (_Py_MakeRecCheck(PyThreadState_GET()->recursion_depth) && \
+ _Py_CheckRecursiveCall(where))
+#define Py_LeaveRecursiveCall() \
+ (--PyThreadState_GET()->recursion_depth)
+PyAPI_FUNC(int) _Py_CheckRecursiveCall(char *where);
+PyAPI_DATA(int) _Py_CheckRecursionLimit;
+#ifdef USE_STACKCHECK
+# define _Py_MakeRecCheck(x) (++(x) > --_Py_CheckRecursionLimit)
+#else
+# define _Py_MakeRecCheck(x) (++(x) > _Py_CheckRecursionLimit)
+#endif
+
PyAPI_FUNC(char *) PyEval_GetFuncName(PyObject *);
PyAPI_FUNC(char *) PyEval_GetFuncDesc(PyObject *);