[Python-checkins] cpython: refactor and avoid warnings
benjamin.peterson
python-checkins at python.org
Fri Mar 9 16:25:39 CET 2012
http://hg.python.org/cpython/rev/46e600fa8d05
changeset: 75508:46e600fa8d05
user: Benjamin Peterson <benjamin at python.org>
date: Fri Mar 09 07:25:32 2012 -0800
summary:
refactor and avoid warnings
files:
Objects/object.c | 12 +++++-------
1 files changed, 5 insertions(+), 7 deletions(-)
diff --git a/Objects/object.c b/Objects/object.c
--- a/Objects/object.c
+++ b/Objects/object.c
@@ -1152,13 +1152,11 @@
name->ob_type->tp_name);
return -1;
}
- else
- Py_INCREF(name);
- if (tp->tp_dict == NULL) {
- if (PyType_Ready(tp) < 0)
- goto done;
- }
+ if (tp->tp_dict == NULL && PyType_Ready(tp) < 0)
+ return -1;
+
+ Py_INCREF(name);
descr = _PyType_Lookup(tp, name);
Py_XINCREF(descr);
@@ -1190,9 +1188,9 @@
res = PyDict_DelItem(dict, name);
else
res = PyDict_SetItem(dict, name, value);
+ Py_DECREF(dict);
if (res < 0 && PyErr_ExceptionMatches(PyExc_KeyError))
PyErr_SetObject(PyExc_AttributeError, name);
- Py_DECREF(dict);
goto done;
}
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list