diff options
author | Brett Cannon <bcannon@gmail.com> | 2007-09-07 04:18:30 (GMT) |
---|---|---|
committer | Brett Cannon <bcannon@gmail.com> | 2007-09-07 04:18:30 (GMT) |
commit | 1e534b5425d836cb58a73d24f0be791d67bf3503 (patch) | |
tree | 1f9fc8b8802c5ba236c026fc6cbe785d7f9bf20b /Objects/typeobject.c | |
parent | 68a6da99e6dc127d817143f74e98d665117f99c2 (diff) | |
download | cpython-1e534b5425d836cb58a73d24f0be791d67bf3503.zip cpython-1e534b5425d836cb58a73d24f0be791d67bf3503.tar.gz cpython-1e534b5425d836cb58a73d24f0be791d67bf3503.tar.bz2 |
Fix a crasher where Python code managed to infinitely recurse in C code without
ever going back out to Python code in PyObject_Call(). Required introducing a
static RuntimeError instance so that normalizing an exception there is no
reliance on a recursive call that would put the exception system over the
recursion check itself.
Diffstat (limited to 'Objects/typeobject.c')
-rw-r--r-- | Objects/typeobject.c | 9 |
1 files changed, 0 insertions, 9 deletions
diff --git a/Objects/typeobject.c b/Objects/typeobject.c index 49b877d..59dec4a 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -4854,16 +4854,7 @@ slot_tp_call(PyObject *self, PyObject *args, PyObject *kwds) if (meth == NULL) return NULL; - /* PyObject_Call() will end up calling slot_tp_call() again if - the object returned for __call__ has __call__ itself defined - upon it. This can be an infinite recursion if you set - __call__ in a class to an instance of it. */ - if (Py_EnterRecursiveCall(" in __call__")) { - Py_DECREF(meth); - return NULL; - } res = PyObject_Call(meth, args, kwds); - Py_LeaveRecursiveCall(); Py_DECREF(meth); return res; |