diff options
-rw-r--r-- | numpy/core/code_generators/generate_array_api.py | 2 | ||||
-rw-r--r-- | numpy/core/code_generators/generate_ufunc_api.py | 2 | ||||
-rw-r--r-- | numpy/core/src/ufuncobject.c | 4 | ||||
-rw-r--r-- | numpy/f2py/rules.py | 4 | ||||
-rw-r--r-- | numpy/lib/function_base.py | 2 | ||||
-rw-r--r-- | numpy/numarray/numpy/libnumarray.h | 2 |
6 files changed, 9 insertions, 7 deletions
diff --git a/numpy/core/code_generators/generate_array_api.py b/numpy/core/code_generators/generate_array_api.py index bd47e64c4..5213affb7 100644 --- a/numpy/core/code_generators/generate_array_api.py +++ b/numpy/core/code_generators/generate_array_api.py @@ -88,7 +88,7 @@ _import_array(void) return 0; } -#define import_array() { if (_import_array() < 0) {PyErr_Print(); Py_FatalError("numpy.core.multiarray failed to import... exiting.\n"); } } +#define import_array() { if (_import_array() < 0) {PyErr_Print(); PyErr_SetString(PyExc_ImportError, "numpy.core.multiarray failed to import"); return; } } #endif diff --git a/numpy/core/code_generators/generate_ufunc_api.py b/numpy/core/code_generators/generate_ufunc_api.py index a55c75e6f..3efe57dc0 100644 --- a/numpy/core/code_generators/generate_ufunc_api.py +++ b/numpy/core/code_generators/generate_ufunc_api.py @@ -48,7 +48,7 @@ _import_umath(void) return 0; } -#define import_umath() { if (_import_umath() < 0) {PyErr_Print(); Py_FatalError("numpy.core.umath failed to import... exiting.\n"); }} +#define import_umath() { if (_import_umath() < 0) {PyErr_Print(); PyErr_SetString(PyExc_ImportError, "numpy.core.umath failed to import\n"); return; }} #define import_ufunc import_umath diff --git a/numpy/core/src/ufuncobject.c b/numpy/core/src/ufuncobject.c index 8cc0be1a7..1f87fd21c 100644 --- a/numpy/core/src/ufuncobject.c +++ b/numpy/core/src/ufuncobject.c @@ -3025,7 +3025,7 @@ ufunc_frompyfunc(PyObject *dummy, PyObject *args, PyObject *kwds) { /*UFUNC_API*/ static int PyUFunc_ReplaceLoopBySignature(PyUFuncObject *func, - PyUFuncGenericFunction *newfunc, + PyUFuncGenericFunction newfunc, int *signature, PyUFuncGenericFunction *oldfunc) { @@ -3033,7 +3033,7 @@ PyUFunc_ReplaceLoopBySignature(PyUFuncObject *func, /* Find the location of the matching signature */ for (i=0; i<func->ntypes; i++) { for (j=0; j<func->nargs; j++) { - if (signature[j] == func->types[i*self->nargs+j]) + if (signature[j] == func->types[i*func->nargs+j]) break; } if (j >= func->nargs) return -1; diff --git a/numpy/f2py/rules.py b/numpy/f2py/rules.py index 5a2d224f8..55e86284f 100644 --- a/numpy/f2py/rules.py +++ b/numpy/f2py/rules.py @@ -173,8 +173,8 @@ PyMODINIT_FUNC init#modulename#(void) { \tm = #modulename#_module = Py_InitModule(\"#modulename#\", f2py_module_methods); \tPyFortran_Type.ob_type = &PyType_Type; \timport_array(); -\tif (PyErr_Occurred()) -\t\tPy_FatalError(\"can't initialize module #modulename# (failed to import numpy)\"); +\tif (PyErr_Occurred()) +\t\t{PyErr_SetString(PyExc_ImportError, \"can't initialize module #modulename# (failed to import numpy)\"); return;} \td = PyModule_GetDict(m); \ts = PyString_FromString(\"$R"""+"""evision: $\"); \tPyDict_SetItemString(d, \"__version__\", s); diff --git a/numpy/lib/function_base.py b/numpy/lib/function_base.py index a62b3569e..0753f18f7 100644 --- a/numpy/lib/function_base.py +++ b/numpy/lib/function_base.py @@ -42,6 +42,8 @@ def linspace(start, stop, num=50, endpoint=True, retstep=False): else: step = (stop-start)/float(num) y = _nx.arange(0, num) * step + start + if endpoint: + y[-1] = stop if retstep: return y, step else: diff --git a/numpy/numarray/numpy/libnumarray.h b/numpy/numarray/numpy/libnumarray.h index 3d838c061..f23a07d7a 100644 --- a/numpy/numarray/numpy/libnumarray.h +++ b/numpy/numarray/numpy/libnumarray.h @@ -56,7 +56,7 @@ static void **libnumarray_API; } \ } -#define import_libnumarray() _import_libnumarray(); if (PyErr_Occurred()) { PyErr_Print(); Py_FatalError("numpy.numarray._capi failed to import... exiting.\n"); } +#define import_libnumarray() _import_libnumarray(); if (PyErr_Occurred()) { PyErr_Print(); PyErr_SetString(PyExc_ImportError, "numpy.numarray._capi failed to import.\n"); return; } #endif |