diff options
| author | Guido van Rossum <guido@python.org> | 2002-12-13 17:49:38 +0000 |
|---|---|---|
| committer | Guido van Rossum <guido@python.org> | 2002-12-13 17:49:38 +0000 |
| commit | 3bbc0eea1045657a054cf302ca98d1236eab058b (patch) | |
| tree | 00165bca78382de52ac711fe3f463381aff8f1e4 /Objects/typeobject.c | |
| parent | 3d87e3cdf7420849e98f153c806fe50fe5131961 (diff) | |
| download | cpython-git-3bbc0eea1045657a054cf302ca98d1236eab058b.tar.gz | |
Tighten the tests for assignment to __bases__: disallow empty tuple.
Diffstat (limited to 'Objects/typeobject.c')
| -rw-r--r-- | Objects/typeobject.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Objects/typeobject.c b/Objects/typeobject.c index 193b0cc1bc..a9c229af17 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -211,6 +211,12 @@ type_set_bases(PyTypeObject *type, PyObject *value, void *context) type->tp_name, value->ob_type->tp_name); return -1; } + if (PyTuple_GET_SIZE(value) == 0) { + PyErr_Format(PyExc_TypeError, + "can only assign non-empty tuple to %s.__bases__, not ()", + type->tp_name); + return -1; + } for (i = 0; i < PyTuple_GET_SIZE(value); i++) { ob = PyTuple_GET_ITEM(value, i); if (!PyClass_Check(ob) && !PyType_Check(ob)) { |
