summaryrefslogtreecommitdiffstats
path: root/Objects/exceptions.c
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2006-05-30 08:17:00 (GMT)
committerGeorg Brandl <georg@python.org>2006-05-30 08:17:00 (GMT)
commitb0432bc032b6f9858e96457276c0f37352103e30 (patch)
tree4851043ca4a2fd3dcd17f26589a534faa1848fe4 /Objects/exceptions.c
parent5b72cd321d06afb23affedda6674303971156497 (diff)
downloadcpython-b0432bc032b6f9858e96457276c0f37352103e30.zip
cpython-b0432bc032b6f9858e96457276c0f37352103e30.tar.gz
cpython-b0432bc032b6f9858e96457276c0f37352103e30.tar.bz2
Do the check for no keyword arguments in __init__ so that
subclasses of Exception can be supplied keyword args
Diffstat (limited to 'Objects/exceptions.c')
-rw-r--r--Objects/exceptions.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/Objects/exceptions.c b/Objects/exceptions.c
index 28fb0c1..fbf10fe 100644
--- a/Objects/exceptions.c
+++ b/Objects/exceptions.c
@@ -32,9 +32,6 @@ BaseException_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
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;
@@ -57,6 +54,9 @@ BaseException_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
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);