From 2b3eb4062c5e50abf854f7e68038243ca7c07217 Mon Sep 17 00:00:00 2001 From: Armin Rigo Date: Tue, 28 Oct 2003 12:05:48 +0000 Subject: Deleting cyclic object comparison. SF patch 825639 http://mail.python.org/pipermail/python-dev/2003-October/039445.html --- Objects/classobject.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'Objects/classobject.c') 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; } -- cgit v1.2.1