summaryrefslogtreecommitdiffstats
path: root/Python/exceptions.c
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2001-08-02 04:15:00 (GMT)
committerTim Peters <tim.peters@gmail.com>2001-08-02 04:15:00 (GMT)
commit6d6c1a35e08b95a83dbe47dbd9e6474daff00354 (patch)
tree542089077b9c2650dcf5c52d6bfcef1baf12d176 /Python/exceptions.c
parent52d55a392600011d3edfe85c694744ec550ad1fe (diff)
downloadcpython-6d6c1a35e08b95a83dbe47dbd9e6474daff00354.zip
cpython-6d6c1a35e08b95a83dbe47dbd9e6474daff00354.tar.gz
cpython-6d6c1a35e08b95a83dbe47dbd9e6474daff00354.tar.bz2
Merge of descr-branch back into trunk.
Diffstat (limited to 'Python/exceptions.c')
-rw-r--r--Python/exceptions.c37
1 files changed, 25 insertions, 12 deletions
diff --git a/Python/exceptions.c b/Python/exceptions.c
index 214d8e5..6fb52ca 100644
--- a/Python/exceptions.c
+++ b/Python/exceptions.c
@@ -1056,23 +1056,36 @@ static struct {
DL_EXPORT(void)
-init_exceptions(void)
+_PyExc_Init(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);
+ 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 (PyErr_Occurred())
+ if (i < 0) {
+ err:
Py_FatalError("exceptions bootstrapping error.");
+ return;
+ }
/* This is the base class of all exceptions, so make it first. */
if (make_Exception(modulename) ||
@@ -1139,7 +1152,7 @@ init_exceptions(void)
DL_EXPORT(void)
-fini_exceptions(void)
+_PyExc_Fini(void)
{
int i;