summaryrefslogtreecommitdiffstats
path: root/Modules/errnomodule.c
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>2000-09-01 09:01:32 (GMT)
committerBarry Warsaw <barry@python.org>2000-09-01 09:01:32 (GMT)
commit9bfd2bf5ede8e5d58775180d6867d81ddcdd3594 (patch)
treecd3adf2b98bc2c0b94980df1953ae9709f46cc28 /Modules/errnomodule.c
parent72dacb80262b73a833802c0b0e5941b8cdb1d79c (diff)
downloadcpython-9bfd2bf5ede8e5d58775180d6867d81ddcdd3594.zip
cpython-9bfd2bf5ede8e5d58775180d6867d81ddcdd3594.tar.gz
cpython-9bfd2bf5ede8e5d58775180d6867d81ddcdd3594.tar.bz2
Do the absolute minimal amount of modifications to eradicate
Py_FatalError() from module initialization functions. The importing mechanism already checks for PyErr_Occurred() after module importation and it Does The Right Thing. Unfortunately, the following either were not compiled or tested by the regression suite, due to issues with my development platform: almodule.c cdmodule.c mpzmodule.c puremodule.c timingmodule.c
Diffstat (limited to 'Modules/errnomodule.c')
-rw-r--r--Modules/errnomodule.c21
1 files changed, 9 insertions, 12 deletions
diff --git a/Modules/errnomodule.c b/Modules/errnomodule.c
index 8607ea2..b47feb6 100644
--- a/Modules/errnomodule.c
+++ b/Modules/errnomodule.c
@@ -35,17 +35,14 @@ static PyMethodDef errno_methods[] = {
static void
_inscode(PyObject *d, PyObject *de, char *name, int code)
{
- PyObject *u;
- PyObject *v;
+ PyObject *u = PyString_FromString(name);
+ PyObject *v = PyInt_FromLong((long) code);
- u = PyString_FromString(name);
- v = PyInt_FromLong((long) code);
-
- if (!u || !v) {
- /* Don't bother reporting this error */
- PyErr_Clear();
- }
- else {
+ /* Don't bother checking for errors; they'll be caught at the end
+ * of the module initialization function by the caller of
+ * initerrno().
+ */
+ if (u && v) {
/* insert in modules dict */
PyDict_SetItem(d, u, v);
/* insert in errorcode dict */
@@ -76,8 +73,8 @@ initerrno(void)
m = Py_InitModule3("errno", errno_methods, errno__doc__);
d = PyModule_GetDict(m);
de = PyDict_New();
- if (de == NULL || PyDict_SetItemString(d, "errorcode", de))
- Py_FatalError("can't initialize errno module");
+ if (!d || !de || PyDict_SetItemString(d, "errorcode", de) < 0)
+ return;
/* Macro so I don't have to edit each and every line below... */
#define inscode(d, ds, de, name, code, comment) _inscode(d, de, name, code)