[Python-checkins] CVS: python/dist/src/Python pythonrun.c,2.133,2.133.4.1 exceptions.c,1.24,1.24.2.1
Guido van Rossum
gvanrossum@users.sourceforge.net
Thu, 28 Jun 2001 09:15:40 -0700
Update of /cvsroot/python/python/dist/src/Python
In directory usw-pr-cvs1:/tmp/cvs-serv3160/Python
Modified Files:
Tag: descr-branch
pythonrun.c exceptions.c
Log Message:
Rename init_exceptions() and fini_exceptions() to _PyExc_Init() and
_PyExc_Fini(). Add some more careful error checks to the start of
_PyExc_Init(). (Using PyErr_Occurred() before the exceptions have been
initialized is not a good idea. :-)
Index: pythonrun.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/pythonrun.c,v
retrieving revision 2.133
retrieving revision 2.133.4.1
diff -C2 -r2.133 -r2.133.4.1
*** pythonrun.c 2001/03/26 19:53:38 2.133
--- pythonrun.c 2001/06/28 16:15:38 2.133.4.1
***************
*** 144,148 ****
/* initialize builtin exceptions */
! init_exceptions();
/* phase 2 of builtins */
--- 144,148 ----
/* initialize builtin exceptions */
! _PyExc_Init();
/* phase 2 of builtins */
***************
*** 238,242 ****
raised.
*/
! fini_exceptions();
/* Delete current thread */
--- 238,242 ----
raised.
*/
! _PyExc_Fini();
/* Delete current thread */
Index: exceptions.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/exceptions.c,v
retrieving revision 1.24
retrieving revision 1.24.2.1
diff -C2 -r1.24 -r1.24.2.1
*** exceptions.c 2001/04/20 19:13:02 1.24
--- exceptions.c 2001/06/28 16:15:38 1.24.2.1
***************
*** 1057,1077 ****
DL_EXPORT(void)
! init_exceptions(void)
{
char *modulename = "exceptions";
int modnamesz = strlen(modulename);
int i;
! PyObject *me = Py_InitModule(modulename, functions);
! PyObject *mydict = PyModule_GetDict(me);
! PyObject *bltinmod = PyImport_ImportModule("__builtin__");
! PyObject *bdict = PyModule_GetDict(bltinmod);
! PyObject *doc = PyString_FromString(module__doc__);
! PyObject *args;
! PyDict_SetItemString(mydict, "__doc__", doc);
Py_DECREF(doc);
! if (PyErr_Occurred())
Py_FatalError("exceptions bootstrapping error.");
/* This is the base class of all exceptions, so make it first. */
--- 1057,1089 ----
DL_EXPORT(void)
! _PyExc_Init(void)
{
char *modulename = "exceptions";
int modnamesz = strlen(modulename);
int i;
+ PyObject *me, *mydict, *bltinmod, *bdict, *doc, *args;
! me = Py_InitModule(modulename, functions);
! if (me == NULL)
! goto err;
! mydict = PyModule_GetDict(me);
! if (mydict == NULL)
! goto err;
! bltinmod = PyImport_ImportModule("__builtin__");
! if (bltinmod == NULL)
! goto err;
! bdict = PyModule_GetDict(bltinmod);
! if (bdict == NULL)
! goto err;
! doc = PyString_FromString(module__doc__);
! if (doc == NULL)
! goto err;
! i = PyDict_SetItemString(mydict, "__doc__", doc);
Py_DECREF(doc);
! if (i < 0) {
! err:
Py_FatalError("exceptions bootstrapping error.");
+ }
/* This is the base class of all exceptions, so make it first. */
***************
*** 1140,1144 ****
DL_EXPORT(void)
! fini_exceptions(void)
{
int i;
--- 1152,1156 ----
DL_EXPORT(void)
! _PyExc_Fini(void)
{
int i;