summaryrefslogtreecommitdiff
path: root/Objects/classobject.c
diff options
context:
space:
mode:
authorArmin Rigo <arigo@tunes.org>2003-10-28 12:05:48 +0000
committerArmin Rigo <arigo@tunes.org>2003-10-28 12:05:48 +0000
commit2b3eb4062c5e50abf854f7e68038243ca7c07217 (patch)
treefc5a73861c6e4feb4f4bc497165fa28d9c81d79f /Objects/classobject.c
parent0e4f76405d79e95abfdda21b9dfc10c7f32340e8 (diff)
downloadcpython-git-2b3eb4062c5e50abf854f7e68038243ca7c07217.tar.gz
Deleting cyclic object comparison.
SF patch 825639 http://mail.python.org/pipermail/python-dev/2003-October/039445.html
Diffstat (limited to 'Objects/classobject.c')
-rw-r--r--Objects/classobject.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/Objects/classobject.c b/Objects/classobject.c
index b0e19347d4..84b297cad9 100644
--- a/Objects/classobject.c
+++ b/Objects/classobject.c
@@ -1970,7 +1970,6 @@ instance_iternext(PyInstanceObject *self)
static PyObject *
instance_call(PyObject *func, PyObject *arg, PyObject *kw)
{
- PyThreadState *tstate = PyThreadState_GET();
PyObject *res, *call = PyObject_GetAttrString(func, "__call__");
if (call == NULL) {
PyInstanceObject *inst = (PyInstanceObject*) func;
@@ -1990,14 +1989,13 @@ instance_call(PyObject *func, PyObject *arg, PyObject *kw)
a() # infinite recursion
This bounces between instance_call() and PyObject_Call() without
ever hitting eval_frame() (which has the main recursion check). */
- if (tstate->recursion_depth++ > Py_GetRecursionLimit()) {
- PyErr_SetString(PyExc_RuntimeError,
- "maximum __call__ recursion depth exceeded");
+ if (Py_EnterRecursiveCall(" in __call__")) {
res = NULL;
}
- else
+ else {
res = PyObject_Call(call, arg, kw);
- tstate->recursion_depth--;
+ Py_LeaveRecursiveCall();
+ }
Py_DECREF(call);
return res;
}