summaryrefslogtreecommitdiff
path: root/numpy/core/src
diff options
context:
space:
mode:
authorTravis Oliphant <oliphant@enthought.com>2006-01-19 05:03:46 +0000
committerTravis Oliphant <oliphant@enthought.com>2006-01-19 05:03:46 +0000
commitee811d8a07cdc121de6ff96d4ffa6482fc8ce410 (patch)
treed150605f97670716dbd3a19137802aa2905148e5 /numpy/core/src
parent6a30aaf84be313b29a4072ec3357ff5e4a6b2d74 (diff)
downloadnumpy-ee811d8a07cdc121de6ff96d4ffa6482fc8ce410.tar.gz
Added NDARRAY_VERSION check on import_array
Diffstat (limited to 'numpy/core/src')
-rw-r--r--numpy/core/src/multiarraymodule.c22
-rw-r--r--numpy/core/src/scalartypes.inc.src1
2 files changed, 22 insertions, 1 deletions
diff --git a/numpy/core/src/multiarraymodule.c b/numpy/core/src/multiarraymodule.c
index c9cfa975f..b402ec831 100644
--- a/numpy/core/src/multiarraymodule.c
+++ b/numpy/core/src/multiarraymodule.c
@@ -4998,6 +4998,26 @@ array_arange(PyObject *ignored, PyObject *args, PyObject *kws) {
return PyArray_ArangeObj(o_start, o_stop, o_step, typecode);
}
+/*MULTIARRAY_API
+ GetNDArrayCVersion
+*/
+static uint
+PyArray_GetNDArrayCVersion(void)
+{
+ return (uint)NDARRAY_VERSION;
+}
+
+static char
+doc__get_ndarray_c_version[] = "_get_ndarray_c_version() gets the compile time NDARRAY_VERSION number";
+
+static PyObject *
+array__get_ndarray_c_version(PyObject *dummy, PyObject *args, PyObject *kwds)
+{
+ static char *kwlist[] = {NULL};
+ if(!PyArg_ParseTupleAndKeywords(args, kwds, "", kwlist )) return NULL;
+
+ return PyInt_FromLong( (long) PyArray_GetNDArrayCVersion() );
+}
static char
doc_set_string_function[] = "set_string_function(f, repr=1) sets the python function f to be the function used to obtain a pretty printable string version of a array whenever a array is printed. f(M) should expect a array argument M, and should return a string consisting of the desired representation of M for printing.";
@@ -5223,6 +5243,8 @@ buffer_buffer(PyObject *dummy, PyObject *args, PyObject *kwds)
static struct PyMethodDef array_module_methods[] = {
+ {"_get_ndarray_c_version", (PyCFunction)array__get_ndarray_c_version,
+ METH_VARARGS|METH_KEYWORDS, doc__get_ndarray_c_version},
{"set_string_function", (PyCFunction)array_set_string_function,
METH_VARARGS|METH_KEYWORDS, doc_set_string_function},
{"set_numeric_ops", (PyCFunction)array_set_ops_function,
diff --git a/numpy/core/src/scalartypes.inc.src b/numpy/core/src/scalartypes.inc.src
index 3503c959c..2d619bd38 100644
--- a/numpy/core/src/scalartypes.inc.src
+++ b/numpy/core/src/scalartypes.inc.src
@@ -32,7 +32,6 @@ static PyBoolScalarObject _PyArrayScalar_BoolValues[] = {
{PyObject_HEAD_INIT(&PyBoolArrType_Type) 1},
};
-
/* Inheritance established later when tp_bases is set (or tp_base for
single inheritance) */