summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Lib/test/test_exceptions.py2
-rw-r--r--Objects/exceptions.c6
2 files changed, 4 insertions, 4 deletions
diff --git a/Lib/test/test_exceptions.py b/Lib/test/test_exceptions.py
index 20e76b9..6d6adbe 100644
--- a/Lib/test/test_exceptions.py
+++ b/Lib/test/test_exceptions.py
@@ -299,7 +299,7 @@ for args in exceptionList:
try:
BaseException(a=1)
-except TypeErrror:
+except TypeError:
pass
else:
raise TestFailed("BaseException shouldn't take keyword args")
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);