From ab3c1c1994ec819781ba27ba8a5c6d75f70cb2af Mon Sep 17 00:00:00 2001 From: Benjamin Peterson Date: Sun, 1 Apr 2012 18:48:02 -0400 Subject: [PATCH 1/3] be consistent with rest of function --- Objects/typeobject.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Objects/typeobject.c b/Objects/typeobject.c index f0c787fa2a5..9f0ab159453 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -475,9 +475,8 @@ type_set_bases(PyTypeObject *type, PyObject *value, void *context) new_base = best_base(value); - if (!new_base) { + if (!new_base) return -1; - } if (!compatible_for_assignment(type->tp_base, new_base, "__bases__")) return -1; From 3471bb67e7add5c809c00e5c0977047017548b40 Mon Sep 17 00:00:00 2001 From: Benjamin Peterson Date: Sun, 1 Apr 2012 18:48:40 -0400 Subject: [PATCH 2/3] remove extraneous condition --- Objects/typeobject.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/Objects/typeobject.c b/Objects/typeobject.c index 9f0ab159453..c12cd7ca32a 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -464,12 +464,10 @@ type_set_bases(PyTypeObject *type, PyObject *value, void *context) type->tp_name, Py_TYPE(ob)->tp_name); return -1; } - if (PyType_Check(ob)) { - if (PyType_IsSubtype((PyTypeObject*)ob, type)) { - PyErr_SetString(PyExc_TypeError, - "a __bases__ item causes an inheritance cycle"); - return -1; - } + if (PyType_IsSubtype((PyTypeObject*)ob, type)) { + PyErr_SetString(PyExc_TypeError, + "a __bases__ item causes an inheritance cycle"); + return -1; } } From b6af60c2a9e2625987bcdd6775eb9fe8834c9641 Mon Sep 17 00:00:00 2001 From: Benjamin Peterson Date: Sun, 1 Apr 2012 18:49:54 -0400 Subject: [PATCH 3/3] adjust formatting --- Objects/typeobject.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Objects/typeobject.c b/Objects/typeobject.c index c12cd7ca32a..8cfa8894b0c 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -458,11 +458,11 @@ type_set_bases(PyTypeObject *type, PyObject *value, void *context) for (i = 0; i < PyTuple_GET_SIZE(value); i++) { ob = PyTuple_GET_ITEM(value, i); if (!PyType_Check(ob)) { - PyErr_Format( - PyExc_TypeError, - "%s.__bases__ must be tuple of old- or new-style classes, not '%s'", - type->tp_name, Py_TYPE(ob)->tp_name); - return -1; + PyErr_Format(PyExc_TypeError, + "%s.__bases__ must be tuple of old- or " + "new-style classes, not '%s'", + type->tp_name, Py_TYPE(ob)->tp_name); + return -1; } if (PyType_IsSubtype((PyTypeObject*)ob, type)) { PyErr_SetString(PyExc_TypeError,