summaryrefslogtreecommitdiff
path: root/numpy/core/src/multiarraymodule.c
diff options
context:
space:
mode:
authorTravis Oliphant <oliphant@enthought.com>2006-08-24 08:36:48 +0000
committerTravis Oliphant <oliphant@enthought.com>2006-08-24 08:36:48 +0000
commitca059fbcebb498f68ccf5eecd692b4c90a6b4bb7 (patch)
treef63a853fab72bb5f9146a55a1c71951c5fb74eac /numpy/core/src/multiarraymodule.c
parent9ab77ec1e9fdd2ebe5dfe2eccd7ad129189ea076 (diff)
downloadnumpy-ca059fbcebb498f68ccf5eecd692b4c90a6b4bb7.tar.gz
Add rudimentary interrupt handliNG. Add max, min, round, abs to the numpy space.
Diffstat (limited to 'numpy/core/src/multiarraymodule.c')
-rw-r--r--numpy/core/src/multiarraymodule.c30
1 files changed, 28 insertions, 2 deletions
diff --git a/numpy/core/src/multiarraymodule.c b/numpy/core/src/multiarraymodule.c
index bbe2bd893..99f1e9684 100644
--- a/numpy/core/src/multiarraymodule.c
+++ b/numpy/core/src/multiarraymodule.c
@@ -21,7 +21,8 @@
*/
#define _MULTIARRAYMODULE
-#include "numpy/noprefix.h"
+#define NPY_NO_PREFIX
+#include "numpy/arrayobject.h"
#define PyAO PyArrayObject
@@ -931,6 +932,10 @@ PyArray_Clip(PyArrayObject *self, PyObject *min, PyObject *max, PyArrayObject *o
return ret;
}
+/* Why doesn't this just call the ufunc?
+ All we need to do is add it to the list of needed ufuncs.
+ */
+
/*MULTIARRAY_API
Conjugate
*/
@@ -6427,6 +6432,24 @@ compare_chararrays(PyObject *dummy, PyObject *args, PyObject *kwds)
+#ifndef NPY_NO_SIGNAL
+
+static PyObject *
+test_interrupt(PyObject *self)
+{
+ int a = 0;
+ NPY_SIGINT_ON
+
+ while(1) {
+ a += 1;
+ }
+
+ NPY_SIGINT_OFF
+
+ return PyInt_FromLong(a);
+}
+#endif
+
static struct PyMethodDef array_module_methods[] = {
{"_get_ndarray_c_version", (PyCFunction)array__get_ndarray_c_version,
METH_VARARGS|METH_KEYWORDS, NULL},
@@ -6481,6 +6504,10 @@ static struct PyMethodDef array_module_methods[] = {
METH_VARARGS | METH_KEYWORDS, NULL},
{"compare_chararrays", (PyCFunction)compare_chararrays,
METH_VARARGS | METH_KEYWORDS, NULL},
+#ifndef NPY_NO_SIGNAL
+ {"test_interrupt", (PyCFunction)test_interrupt,
+ METH_NOARGS, NULL},
+#endif
{NULL, NULL, 0} /* sentinel */
};
@@ -6680,7 +6707,6 @@ PyMODINIT_FUNC initmultiarray(void) {
return;
c_api = PyCObject_FromVoidPtr((void *)PyArray_API, NULL);
- if (PyErr_Occurred()) goto err;
PyDict_SetItemString(d, "_ARRAY_API", c_api);
Py_DECREF(c_api);
if (PyErr_Occurred()) goto err;