summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2013-07-16 20:51:21 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2013-07-16 20:51:21 (GMT)
commit3997cfdb7fa75fece43288e89e80b4eaaae7be0a (patch)
tree5fec2ca495af566792964a90c74a9af2c6b5329d /Objects
parent1e53bbacedaed883104454693c29d1ad31f5029b (diff)
downloadcpython-3997cfdb7fa75fece43288e89e80b4eaaae7be0a.zip
cpython-3997cfdb7fa75fece43288e89e80b4eaaae7be0a.tar.gz
cpython-3997cfdb7fa75fece43288e89e80b4eaaae7be0a.tar.bz2
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.
Diffstat (limited to 'Objects')
-rw-r--r--Objects/typeobject.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
index 9b69021..f311af8 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;