Commit 3997cfdb authored by Victor Stinner's avatar Victor Stinner

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.
parent 1e53bbac
...@@ -750,12 +750,14 @@ type_call(PyTypeObject *type, PyObject *args, PyObject *kwds) ...@@ -750,12 +750,14 @@ type_call(PyTypeObject *type, PyObject *args, PyObject *kwds)
if (!PyType_IsSubtype(Py_TYPE(obj), type)) if (!PyType_IsSubtype(Py_TYPE(obj), type))
return obj; return obj;
type = Py_TYPE(obj); type = Py_TYPE(obj);
if (type->tp_init != NULL && if (type->tp_init != NULL) {
type->tp_init(obj, args, kwds) < 0) { int res = type->tp_init(obj, args, kwds);
if (res < 0) {
Py_DECREF(obj); Py_DECREF(obj);
obj = NULL; obj = NULL;
} }
} }
}
return obj; return obj;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment