1010#include "osdefs.h"
1111
1212#define MAKE_IT_NONE (x ) (x) = Py_None; Py_INCREF(Py_None);
13- #define EXC_MODULE_NAME "exceptions."
1413
1514/* NOTE: If the exception class hierarchy changes, don't forget to update
1615 * Lib/test/exception_hierarchy.txt
1716 */
1817
19- PyDoc_STRVAR (exceptions_doc , "Python's standard exception class hierarchy.\n\
20- \n\
21- Exceptions found here are defined both in the exceptions module and the\n\
22- built-in namespace. It is recommended that user-defined exceptions\n\
23- inherit from Exception. See the documentation for the exception\n\
24- inheritance hierarchy.\n\
25- " );
26-
2718/*
2819 * BaseException
2920 */
@@ -282,7 +273,7 @@ static PyGetSetDef BaseException_getset[] = {
282273static PyTypeObject _PyExc_BaseException = {
283274 PyObject_HEAD_INIT (NULL )
284275 0 , /*ob_size*/
285- EXC_MODULE_NAME "BaseException" , /*tp_name*/
276+ "BaseException" , /*tp_name*/
286277 sizeof (PyBaseExceptionObject ), /*tp_basicsize*/
287278 0 , /*tp_itemsize*/
288279 (destructor )BaseException_dealloc , /*tp_dealloc*/
@@ -333,7 +324,7 @@ PyObject *PyExc_BaseException = (PyObject *)&_PyExc_BaseException;
333324static PyTypeObject _PyExc_ ## EXCNAME = { \
334325 PyObject_HEAD_INIT(NULL) \
335326 0, \
336- EXC_MODULE_NAME # EXCNAME, \
327+ # EXCNAME, \
337328 sizeof(PyBaseExceptionObject), \
338329 0, (destructor)BaseException_dealloc, 0, 0, 0, 0, 0, 0, 0, \
339330 0, 0, 0, 0, 0, 0, 0, \
@@ -349,7 +340,7 @@ PyObject *PyExc_ ## EXCNAME = (PyObject *)&_PyExc_ ## EXCNAME
349340static PyTypeObject _PyExc_ ## EXCNAME = { \
350341 PyObject_HEAD_INIT(NULL) \
351342 0, \
352- EXC_MODULE_NAME # EXCNAME, \
343+ # EXCNAME, \
353344 sizeof(Py ## EXCSTORE ## Object), \
354345 0, (destructor)EXCSTORE ## _dealloc, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
355346 0, 0, 0, 0, 0, \
@@ -365,7 +356,7 @@ PyObject *PyExc_ ## EXCNAME = (PyObject *)&_PyExc_ ## EXCNAME
365356static PyTypeObject _PyExc_ ## EXCNAME = { \
366357 PyObject_HEAD_INIT(NULL) \
367358 0, \
368- EXC_MODULE_NAME # EXCNAME, \
359+ # EXCNAME, \
369360 sizeof(Py ## EXCSTORE ## Object), 0, \
370361 (destructor)EXCSTORE ## _dealloc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
371362 (reprfunc)EXCSTR, 0, 0, 0, \
@@ -1632,7 +1623,7 @@ UnicodeEncodeError_str(PyObject *self)
16321623static PyTypeObject _PyExc_UnicodeEncodeError = {
16331624 PyObject_HEAD_INIT (NULL )
16341625 0 ,
1635- EXC_MODULE_NAME "UnicodeEncodeError" ,
1626+ "UnicodeEncodeError" ,
16361627 sizeof (PyUnicodeErrorObject ), 0 ,
16371628 (destructor )UnicodeError_dealloc , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,
16381629 (reprfunc )UnicodeEncodeError_str , 0 , 0 , 0 ,
@@ -1704,7 +1695,7 @@ UnicodeDecodeError_str(PyObject *self)
17041695static PyTypeObject _PyExc_UnicodeDecodeError = {
17051696 PyObject_HEAD_INIT (NULL )
17061697 0 ,
1707- EXC_MODULE_NAME "UnicodeDecodeError" ,
1698+ "UnicodeDecodeError" ,
17081699 sizeof (PyUnicodeErrorObject ), 0 ,
17091700 (destructor )UnicodeError_dealloc , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,
17101701 (reprfunc )UnicodeDecodeError_str , 0 , 0 , 0 ,
@@ -1802,7 +1793,7 @@ UnicodeTranslateError_str(PyObject *self)
18021793static PyTypeObject _PyExc_UnicodeTranslateError = {
18031794 PyObject_HEAD_INIT (NULL )
18041795 0 ,
1805- EXC_MODULE_NAME "UnicodeTranslateError" ,
1796+ "UnicodeTranslateError" ,
18061797 sizeof (PyUnicodeErrorObject ), 0 ,
18071798 (destructor )UnicodeError_dealloc , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,
18081799 (reprfunc )UnicodeTranslateError_str , 0 , 0 , 0 ,
@@ -1956,17 +1947,10 @@ SimpleExtendsException(PyExc_Warning, UnicodeWarning,
19561947 */
19571948PyObject * PyExc_MemoryErrorInst = NULL ;
19581949
1959- /* module global functions */
1960- static PyMethodDef functions [] = {
1961- /* Sentinel */
1962- {NULL , NULL }
1963- };
1964-
19651950#define PRE_INIT (TYPE ) if (PyType_Ready(&_PyExc_ ## TYPE) < 0) \
19661951 Py_FatalError("exceptions bootstrapping error.");
19671952
19681953#define POST_INIT (TYPE ) Py_INCREF(PyExc_ ## TYPE); \
1969- PyModule_AddObject(m, # TYPE, PyExc_ ## TYPE); \
19701954 if (PyDict_SetItemString(bdict, # TYPE, PyExc_ ## TYPE)) \
19711955 Py_FatalError("Module dictionary insertion problem.");
19721956
@@ -1996,7 +1980,7 @@ InvalidParameterHandler(
19961980PyMODINIT_FUNC
19971981_PyExc_Init (void )
19981982{
1999- PyObject * m , * bltinmod , * bdict ;
1983+ PyObject * bltinmod , * bdict ;
20001984
20011985 PRE_INIT (BaseException )
20021986 PRE_INIT (Exception )
@@ -2053,10 +2037,6 @@ _PyExc_Init(void)
20532037 PRE_INIT (ImportWarning )
20542038 PRE_INIT (UnicodeWarning )
20552039
2056- m = Py_InitModule4 ("exceptions" , functions , exceptions_doc ,
2057- (PyObject * )NULL , PYTHON_API_VERSION );
2058- if (m == NULL ) return ;
2059-
20602040 bltinmod = PyImport_ImportModule ("__builtin__" );
20612041 if (bltinmod == NULL )
20622042 Py_FatalError ("exceptions bootstrapping error." );
0 commit comments