From ee811d8a07cdc121de6ff96d4ffa6482fc8ce410 Mon Sep 17 00:00:00 2001 From: Travis Oliphant Date: Thu, 19 Jan 2006 05:03:46 +0000 Subject: Added NDARRAY_VERSION check on import_array --- numpy/core/src/multiarraymodule.c | 22 ++++++++++++++++++++++ numpy/core/src/scalartypes.inc.src | 1 - 2 files changed, 22 insertions(+), 1 deletion(-) (limited to 'numpy/core/src') 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) */ -- cgit v1.2.1