[Python-checkins] cpython: Cleanup type_call() to ease debug
victor.stinner
python-checkins at python.org
Tue Jul 16 23:09:25 CEST 2013
http://hg.python.org/cpython/rev/ffd3c6ee2a3a
changeset: 84677:ffd3c6ee2a3a
user: Victor Stinner <victor.stinner at gmail.com>
date: Tue Jul 16 22:51:21 2013 +0200
summary:
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.
files:
Objects/typeobject.c | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -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;
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list