diff Objects/typeobject.c @ 26645:d176cbfd3765 legacy-trunk

Tighten the tests for assignment to __bases__: disallow empty tuple.
author Guido van Rossum <guido@python.org>
date Fri, 13 Dec 2002 17:49:38 +0000
parents 8991f78817c7
children f838bc9056cc
line wrap: on
line diff
--- a/Objects/typeobject.c	Fri Dec 13 15:25:26 2002 +0000
+++ b/Objects/typeobject.c	Fri Dec 13 17:49:38 2002 +0000
@@ -211,6 +211,12 @@
 			     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)) {