mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
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.
This commit is contained in:
parent
1e53bbaced
commit
3997cfdb7f
1 changed files with 6 additions and 4 deletions
|
@ -750,10 +750,12 @@ 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);
|
||||||
Py_DECREF(obj);
|
if (res < 0) {
|
||||||
obj = NULL;
|
Py_DECREF(obj);
|
||||||
|
obj = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return obj;
|
return obj;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue