subclasses of Exception can be supplied keyword args
try:
BaseException(a=1)
-except TypeErrror:
+except TypeError:
pass
else:
raise TestFailed("BaseException shouldn't take keyword args")
{
PyBaseExceptionObject *self;
- if (!_PyArg_NoKeywords("BaseException", kwds))
- return NULL;
-
self = (PyBaseExceptionObject *)type->tp_alloc(type, 0);
/* the dict is created on the fly in PyObject_GenericSetAttr */
self->message = self->dict = NULL;
static int
BaseException_init(PyBaseExceptionObject *self, PyObject *args, PyObject *kwds)
{
+ if (!_PyArg_NoKeywords(self->ob_type->tp_name, kwds))
+ return -1;
+
Py_DECREF(self->args);
self->args = args;
Py_INCREF(self->args);