Index: ceval.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v retrieving revision 2.416 diff -u -r2.416 ceval.c --- ceval.c 29 Aug 2004 15:51:52 -0000 2.416 +++ ceval.c 13 Sep 2004 05:06:35 -0000 @@ -4086,10 +4086,23 @@ /* A type error here likely means that the user passed in a base that was not a class (such the random module instead of the random.random type). Help them out with - a more informative error message */ - PyErr_SetString(PyExc_TypeError, - "Error when calling the metaclass.\n" \ - "Make sure the base arguments are valid."); + by augmenting the error message with more information.*/ + + PyObject *ptype, *pvalue, *ptraceback; + + PyErr_Fetch(&ptype, &pvalue, &ptraceback); + if (PyString_Check(pvalue)) { + PyObject *newmsg; + newmsg = PyString_FromFormat( + "Error when calling the metaclass bases\n %s", + PyString_AS_STRING(pvalue)); + if (newmsg != NULL) { + Py_DECREF(pvalue); + pvalue = newmsg; + } else if (PyErr_Occurred()) + PyErr_Clear(); + } + PyErr_Restore(ptype, pvalue, ptraceback); } return result; }