Skip to content

Commit 5b6d626

Browse files
committed
use ComplexExtendsException
1 parent a53da37 commit 5b6d626

1 file changed

Lines changed: 6 additions & 17 deletions

File tree

Objects/exceptions.c

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1905,23 +1905,12 @@ static PyMethodDef ImportError_methods[] = {
19051905
{NULL}
19061906
};
19071907

1908-
static PyTypeObject _PyExc_ImportError = {
1909-
PyVarObject_HEAD_INIT(NULL, 0)
1910-
"ImportError",
1911-
sizeof(PyImportErrorObject), 0,
1912-
(destructor)ImportError_dealloc, 0, 0, 0, 0,
1913-
(reprfunc)ImportError_repr, 0, 0, 0, 0, 0,
1914-
(reprfunc)ImportError_str, 0, 0, 0,
1915-
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC,
1916-
PyDoc_STR("Import can't find module, or can't find name in "
1917-
"module."),
1918-
(traverseproc)ImportError_traverse,
1919-
(inquiry)ImportError_clear, 0, 0, 0, 0, ImportError_methods,
1920-
ImportError_members, 0, &_PyExc_Exception,
1921-
0, 0, 0, offsetof(PyImportErrorObject, dict),
1922-
(initproc)ImportError_init,
1923-
};
1924-
PyObject *PyExc_ImportError = (PyObject *)&_PyExc_ImportError;
1908+
ComplexExtendsException(PyExc_Exception, ImportError,
1909+
ImportError, 0 /* new */,
1910+
ImportError_methods, ImportError_members,
1911+
0 /* getset */, ImportError_str,
1912+
"Import can't find module, or can't find name in "
1913+
"module.");
19251914

19261915
/*
19271916
* ModuleNotFoundError extends ImportError

0 commit comments

Comments
 (0)