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
diff --git a/Modules/mpzmodule.c b/Modules/mpzmodule.c
index ad52736..8be9f08 100644
--- a/Modules/mpzmodule.c
+++ b/Modules/mpzmodule.c
@@ -1729,23 +1729,25 @@
/* create some frequently used constants */
if ((mpz_value_zero = newmpzobject()) == NULL)
- Py_FatalError("initmpz: can't initialize mpz constants");
+ goto finally;
mpz_set_ui(&mpz_value_zero->mpz, (unsigned long int)0);
if ((mpz_value_one = newmpzobject()) == NULL)
- Py_FatalError("initmpz: can't initialize mpz constants");
+ goto finally;
mpz_set_ui(&mpz_value_one->mpz, (unsigned long int)1);
if ((mpz_value_mone = newmpzobject()) == NULL)
- Py_FatalError("initmpz: can't initialize mpz constants");
+ goto finally;
mpz_set_si(&mpz_value_mone->mpz, (long)-1);
dict = PyModule_GetDict(module);
if (dict != NULL) {
PyDict_SetItemString(dict, "MPZType", (PyObject*)&MPZtype);
}
-
+ finally:
+ return;
} /* initmpz() */
+
#ifdef MAKEDUMMYINT
int _mpz_dummy_int; /* XXX otherwise, we're .bss-less (DYNLOAD->Jack?) */
#endif /* def MAKEDUMMYINT */