diff options
author | Neal Norwitz <nnorwitz@gmail.com> | 2007-02-26 22:22:47 (GMT) |
---|---|---|
committer | Neal Norwitz <nnorwitz@gmail.com> | 2007-02-26 22:22:47 (GMT) |
commit | 2633c69fae7e413b2b64b01d8c0c901ae649a225 (patch) | |
tree | 144a1f97f427f019a8ddaae96a8f0da6a09df985 /Objects | |
parent | f543348fff32ae20a9fd2c7f70a3549a3280048c (diff) | |
download | cpython-2633c69fae7e413b2b64b01d8c0c901ae649a225.zip cpython-2633c69fae7e413b2b64b01d8c0c901ae649a225.tar.gz cpython-2633c69fae7e413b2b64b01d8c0c901ae649a225.tar.bz2 |
Remove the exceptions builtin module, all the exceptions are already builtin.
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/exceptions.c | 36 |
1 files changed, 8 insertions, 28 deletions
diff --git a/Objects/exceptions.c b/Objects/exceptions.c index 402bcec..cea41f8 100644 --- a/Objects/exceptions.c +++ b/Objects/exceptions.c @@ -10,20 +10,11 @@ #include "osdefs.h" #define MAKE_IT_NONE(x) (x) = Py_None; Py_INCREF(Py_None); -#define EXC_MODULE_NAME "exceptions." /* NOTE: If the exception class hierarchy changes, don't forget to update * Lib/test/exception_hierarchy.txt */ -PyDoc_STRVAR(exceptions_doc, "Python's standard exception class hierarchy.\n\ -\n\ -Exceptions found here are defined both in the exceptions module and the\n\ -built-in namespace. It is recommended that user-defined exceptions\n\ -inherit from Exception. See the documentation for the exception\n\ -inheritance hierarchy.\n\ -"); - /* * BaseException */ @@ -282,7 +273,7 @@ static PyGetSetDef BaseException_getset[] = { static PyTypeObject _PyExc_BaseException = { PyObject_HEAD_INIT(NULL) 0, /*ob_size*/ - EXC_MODULE_NAME "BaseException", /*tp_name*/ + "BaseException", /*tp_name*/ sizeof(PyBaseExceptionObject), /*tp_basicsize*/ 0, /*tp_itemsize*/ (destructor)BaseException_dealloc, /*tp_dealloc*/ @@ -333,7 +324,7 @@ PyObject *PyExc_BaseException = (PyObject *)&_PyExc_BaseException; static PyTypeObject _PyExc_ ## EXCNAME = { \ PyObject_HEAD_INIT(NULL) \ 0, \ - EXC_MODULE_NAME # EXCNAME, \ + # EXCNAME, \ sizeof(PyBaseExceptionObject), \ 0, (destructor)BaseException_dealloc, 0, 0, 0, 0, 0, 0, 0, \ 0, 0, 0, 0, 0, 0, 0, \ @@ -349,7 +340,7 @@ PyObject *PyExc_ ## EXCNAME = (PyObject *)&_PyExc_ ## EXCNAME static PyTypeObject _PyExc_ ## EXCNAME = { \ PyObject_HEAD_INIT(NULL) \ 0, \ - EXC_MODULE_NAME # EXCNAME, \ + # EXCNAME, \ sizeof(Py ## EXCSTORE ## Object), \ 0, (destructor)EXCSTORE ## _dealloc, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ 0, 0, 0, 0, 0, \ @@ -365,7 +356,7 @@ PyObject *PyExc_ ## EXCNAME = (PyObject *)&_PyExc_ ## EXCNAME static PyTypeObject _PyExc_ ## EXCNAME = { \ PyObject_HEAD_INIT(NULL) \ 0, \ - EXC_MODULE_NAME # EXCNAME, \ + # EXCNAME, \ sizeof(Py ## EXCSTORE ## Object), 0, \ (destructor)EXCSTORE ## _dealloc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ (reprfunc)EXCSTR, 0, 0, 0, \ @@ -1632,7 +1623,7 @@ UnicodeEncodeError_str(PyObject *self) static PyTypeObject _PyExc_UnicodeEncodeError = { PyObject_HEAD_INIT(NULL) 0, - EXC_MODULE_NAME "UnicodeEncodeError", + "UnicodeEncodeError", sizeof(PyUnicodeErrorObject), 0, (destructor)UnicodeError_dealloc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, (reprfunc)UnicodeEncodeError_str, 0, 0, 0, @@ -1704,7 +1695,7 @@ UnicodeDecodeError_str(PyObject *self) static PyTypeObject _PyExc_UnicodeDecodeError = { PyObject_HEAD_INIT(NULL) 0, - EXC_MODULE_NAME "UnicodeDecodeError", + "UnicodeDecodeError", sizeof(PyUnicodeErrorObject), 0, (destructor)UnicodeError_dealloc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, (reprfunc)UnicodeDecodeError_str, 0, 0, 0, @@ -1802,7 +1793,7 @@ UnicodeTranslateError_str(PyObject *self) static PyTypeObject _PyExc_UnicodeTranslateError = { PyObject_HEAD_INIT(NULL) 0, - EXC_MODULE_NAME "UnicodeTranslateError", + "UnicodeTranslateError", sizeof(PyUnicodeErrorObject), 0, (destructor)UnicodeError_dealloc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, (reprfunc)UnicodeTranslateError_str, 0, 0, 0, @@ -1956,17 +1947,10 @@ SimpleExtendsException(PyExc_Warning, UnicodeWarning, */ PyObject *PyExc_MemoryErrorInst=NULL; -/* module global functions */ -static PyMethodDef functions[] = { - /* Sentinel */ - {NULL, NULL} -}; - #define PRE_INIT(TYPE) if (PyType_Ready(&_PyExc_ ## TYPE) < 0) \ Py_FatalError("exceptions bootstrapping error."); #define POST_INIT(TYPE) Py_INCREF(PyExc_ ## TYPE); \ - PyModule_AddObject(m, # TYPE, PyExc_ ## TYPE); \ if (PyDict_SetItemString(bdict, # TYPE, PyExc_ ## TYPE)) \ Py_FatalError("Module dictionary insertion problem."); @@ -1996,7 +1980,7 @@ InvalidParameterHandler( PyMODINIT_FUNC _PyExc_Init(void) { - PyObject *m, *bltinmod, *bdict; + PyObject *bltinmod, *bdict; PRE_INIT(BaseException) PRE_INIT(Exception) @@ -2053,10 +2037,6 @@ _PyExc_Init(void) PRE_INIT(ImportWarning) PRE_INIT(UnicodeWarning) - m = Py_InitModule4("exceptions", functions, exceptions_doc, - (PyObject *)NULL, PYTHON_API_VERSION); - if (m == NULL) return; - bltinmod = PyImport_ImportModule("__builtin__"); if (bltinmod == NULL) Py_FatalError("exceptions bootstrapping error."); |