diff options
author | Travis Oliphant <oliphant@enthought.com> | 2006-01-24 17:57:17 +0000 |
---|---|---|
committer | Travis Oliphant <oliphant@enthought.com> | 2006-01-24 17:57:17 +0000 |
commit | 0917323eb52e2eed8bc84bf844cbcdcd6e6bd12e (patch) | |
tree | bfb9d75c864e35745385f339bbf95507cb694961 | |
parent | 5beecfe93c4755dc18726b8135e79ef06cdfc470 (diff) | |
download | numpy-0917323eb52e2eed8bc84bf844cbcdcd6e6bd12e.tar.gz |
Don't raise fatal errors on load.
-rw-r--r-- | numpy/core/src/multiarraymodule.c | 9 | ||||
-rw-r--r-- | numpy/core/src/umathmodule.c.src | 7 | ||||
-rw-r--r-- | numpy/lib/src/_compiled_base.c | 6 | ||||
-rw-r--r-- | numpy/linalg/lapack_litemodule.c | 5 |
4 files changed, 13 insertions, 14 deletions
diff --git a/numpy/core/src/multiarraymodule.c b/numpy/core/src/multiarraymodule.c index 510adda9d..48b07d70d 100644 --- a/numpy/core/src/multiarraymodule.c +++ b/numpy/core/src/multiarraymodule.c @@ -5691,11 +5691,10 @@ DL_EXPORT(void) initmultiarray(void) { if (_numpy_internal != NULL) return; err: - /* Check for errors */ - if (PyErr_Occurred()) - PyErr_Print(); - Py_FatalError("can't initialize module multiarray"); - + if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_RuntimeError, + "cannot load multiarray module."); + } return; } diff --git a/numpy/core/src/umathmodule.c.src b/numpy/core/src/umathmodule.c.src index 1375efaa0..d2d0ca075 100644 --- a/numpy/core/src/umathmodule.c.src +++ b/numpy/core/src/umathmodule.c.src @@ -2056,6 +2056,9 @@ DL_EXPORT(void) initumath(void) { err: /* Check for errors */ - if (PyErr_Occurred()) - Py_FatalError("can't initialize module umath"); + if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_RuntimeError, + "cannot load umath module."); + } + return; } diff --git a/numpy/lib/src/_compiled_base.c b/numpy/lib/src/_compiled_base.c index 797fc7a1f..9af8fca0f 100644 --- a/numpy/lib/src/_compiled_base.c +++ b/numpy/lib/src/_compiled_base.c @@ -437,7 +437,7 @@ DL_EXPORT(void) init_compiled_base(void) { m = Py_InitModule("_compiled_base", methods); /* Import the array and ufunc objects */ - import_array(); + if (import_array() < 0) return; /* Add some symbolic constants to the module */ d = PyModule_GetDict(m); @@ -454,7 +454,5 @@ DL_EXPORT(void) init_compiled_base(void) { /* define PyGetSetDescr_Type and PyMemberDescr_Type */ define_types(); - /* Check for errors */ - if (PyErr_Occurred()) - Py_FatalError("can't initialize module _compiled_base"); + return; } diff --git a/numpy/linalg/lapack_litemodule.c b/numpy/linalg/lapack_litemodule.c index 10ce4b944..5128fa85c 100644 --- a/numpy/linalg/lapack_litemodule.c +++ b/numpy/linalg/lapack_litemodule.c @@ -682,11 +682,10 @@ initlapack_lite(void) m = Py_InitModule4("lapack_lite", lapack_lite_module_methods, lapack_lite_module_documentation, (PyObject*)NULL,PYTHON_API_VERSION); - import_array(); + if (import_array() < 0) return; d = PyModule_GetDict(m); LapackError = PyErr_NewException("lapack_lite.LapackError", NULL, NULL); PyDict_SetItemString(d, "LapackError", LapackError); - if (PyErr_Occurred()) - Py_FatalError("can't initialize module lapack_lite"); + return; } |