From: Victor Stinner Date: Tue, 16 Jul 2013 20:51:21 +0000 (+0200) Subject: Cleanup type_call() to ease debug X-Git-Tag: v3.4.0a1~180 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3997cfdb7fa75fece43288e89e80b4eaaae7be0a;p=python Cleanup type_call() to ease debug It was easy to miss the call to type->tp_init because it was done in a long conditional expression. Split the long expression in multiple lines to make the debug step by step easier. --- diff --git a/Objects/typeobject.c b/Objects/typeobject.c index 9b69021299..f311af8f25 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -750,10 +750,12 @@ type_call(PyTypeObject *type, PyObject *args, PyObject *kwds) if (!PyType_IsSubtype(Py_TYPE(obj), type)) return obj; type = Py_TYPE(obj); - if (type->tp_init != NULL && - type->tp_init(obj, args, kwds) < 0) { - Py_DECREF(obj); - obj = NULL; + if (type->tp_init != NULL) { + int res = type->tp_init(obj, args, kwds); + if (res < 0) { + Py_DECREF(obj); + obj = NULL; + } } } return obj;