Mercurial > cpython-lru_cache-weakref
changeset 84677:ffd3c6ee2a3a
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.
| author | Victor Stinner <victor.stinner@gmail.com> |
|---|---|
| date | Tue, 16 Jul 2013 22:51:21 +0200 |
| parents | 6bd01a59762a |
| children | c8696ee49291 |
| files | Objects/typeobject.c |
| diffstat | 1 files changed, 6 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/Objects/typeobject.c Tue Jul 16 22:26:05 2013 +0200 +++ b/Objects/typeobject.c Tue Jul 16 22:51:21 2013 +0200 @@ -750,10 +750,12 @@ 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;
