diff options
author | Travis Oliphant <oliphant@enthought.com> | 2006-03-01 06:49:10 +0000 |
---|---|---|
committer | Travis Oliphant <oliphant@enthought.com> | 2006-03-01 06:49:10 +0000 |
commit | 6fd31c330e6572963a03b71bcd479dbedd153ac8 (patch) | |
tree | fbf440a9710b74562156e3218b595b1d78e0b74f /numpy/core/src | |
parent | 3f8c2dea68dd5d8b437a02f002836f09644e5c3f (diff) | |
download | numpy-6fd31c330e6572963a03b71bcd479dbedd153ac8.tar.gz |
Remove bigndarray because Python SVN has support for 64-bit indexing.
Diffstat (limited to 'numpy/core/src')
-rw-r--r-- | numpy/core/src/arraymethods.c | 10 | ||||
-rw-r--r-- | numpy/core/src/arrayobject.c | 62 | ||||
-rw-r--r-- | numpy/core/src/multiarraymodule.c | 23 | ||||
-rw-r--r-- | numpy/core/src/ufuncobject.c | 10 |
4 files changed, 32 insertions, 73 deletions
diff --git a/numpy/core/src/arraymethods.c b/numpy/core/src/arraymethods.c index 5d1ac1f18..bf64fd6c6 100644 --- a/numpy/core/src/arraymethods.c +++ b/numpy/core/src/arraymethods.c @@ -166,9 +166,9 @@ array_view(PyArrayObject *self, PyObject *args) if (!PyArg_ParseTuple(args, "|O", &otype)) return NULL; if (otype) { - if (PyType_Check(otype) && \ + if (PyType_Check(otype) && \ PyType_IsSubtype((PyTypeObject *)otype, - &PyBigArray_Type)) { + &PyArray_Type)) { return PyArray_View(self, NULL, (PyTypeObject *)otype); } @@ -604,13 +604,13 @@ array_getarray(PyArrayObject *self, PyObject *args) if (!PyArg_ParseTuple(args, "|O&", PyArray_DescrConverter, &newtype)) return NULL; - /* convert to PyArray_Type or PyBigArray_Type */ - if (!PyArray_CheckExact(self) || !PyBigArray_CheckExact(self)) { + /* convert to PyArray_Type */ + if (!PyArray_CheckExact(self)) { PyObject *new; PyTypeObject *subtype = &PyArray_Type; if (!PyType_IsSubtype(self->ob_type, &PyArray_Type)) { - subtype = &PyBigArray_Type; + subtype = &PyArray_Type; } Py_INCREF(PyArray_DESCR(self)); diff --git a/numpy/core/src/arrayobject.c b/numpy/core/src/arrayobject.c index fe53283a5..6b8012f73 100644 --- a/numpy/core/src/arrayobject.c +++ b/numpy/core/src/arrayobject.c @@ -32,8 +32,6 @@ PyArray_GetPriority(PyObject *obj, double default_) if (PyArray_CheckExact(obj)) return priority; - if (PyBigArray_CheckExact(obj)) - return PyArray_BIG_PRIORITY; ret = PyObject_GetAttrString(obj, "__array_priority__"); if (ret != NULL) priority = PyFloat_AsDouble(ret); @@ -3917,7 +3915,7 @@ PyArray_NewFromDescr(PyTypeObject *subtype, PyArray_Descr *descr, int nd, /* call the __array_finalize__ method if a subtype and some object passed in */ - if ((subtype != &PyArray_Type) && (subtype != &PyBigArray_Type)) { + if ((subtype != &PyArray_Type)) { PyObject *res, *func, *args; static PyObject *str=NULL; @@ -4421,8 +4419,6 @@ array_priority_get(PyArrayObject *self) { if (PyArray_CheckExact(self)) return PyFloat_FromDouble(PyArray_PRIORITY); - else if (PyBigArray_CheckExact(self)) - return PyFloat_FromDouble(PyArray_BIG_PRIORITY); else return PyFloat_FromDouble(PyArray_SUBTYPE_PRIORITY); } @@ -5027,10 +5023,10 @@ static char Arraytype__doc__[] = " No __init__ method is needed because the array is fully \n" " initialized after the __new__ method."; -static PyTypeObject PyBigArray_Type = { +static PyTypeObject PyArray_Type = { PyObject_HEAD_INIT(NULL) 0, /*ob_size*/ - "numpy.bigndarray", /*tp_name*/ + "numpy.ndarray", /*tp_name*/ sizeof(PyArrayObject), /*tp_basicsize*/ 0, /*tp_itemsize*/ /* methods */ @@ -5041,7 +5037,7 @@ static PyTypeObject PyBigArray_Type = { (cmpfunc)0, /*tp_compare*/ (reprfunc)array_repr, /*tp_repr*/ &array_as_number, /*tp_as_number*/ - NULL, /*tp_as_sequence*/ + &array_as_sequence, /*tp_as_sequence*/ &array_as_mapping, /*tp_as_mapping*/ (hashfunc)0, /*tp_hash*/ (ternaryfunc)0, /*tp_call*/ @@ -5049,7 +5045,7 @@ static PyTypeObject PyBigArray_Type = { (getattrofunc)0, /*tp_getattro*/ (setattrofunc)0, /*tp_setattro*/ - NULL, /*tp_as_buffer*/ + &array_as_buffer, /*tp_as_buffer*/ (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_CHECKTYPES), /*tp_flags*/ @@ -5088,20 +5084,6 @@ static PyTypeObject PyBigArray_Type = { 0 /* tp_weaklist */ }; -/* A standard array will subclass from the Big Array and - add the array_as_sequence table - and the array_as_buffer table - */ - -static PyTypeObject PyArray_Type = { - PyObject_HEAD_INIT(NULL) - 0, /*ob_size*/ - "numpy.ndarray", /*tp_name*/ - sizeof(PyArrayObject), /*tp_basicsize*/ - 0, /*tp_itemsize*/ -}; - - /* The rest of this code is to build the right kind of array from a python */ /* object. */ @@ -5804,8 +5786,7 @@ PyArray_FromArray(PyArrayObject *arr, PyArray_Descr *newtype, int flags) PyErr_SetString(PyExc_ValueError, msg); return NULL; } - if ((flags & ENSUREARRAY) && \ - (subtype != &PyBigArray_Type)) { + if ((flags & ENSUREARRAY)) { subtype = &PyArray_Type; } ret = (PyArrayObject *) \ @@ -5828,8 +5809,7 @@ PyArray_FromArray(PyArrayObject *arr, PyArray_Descr *newtype, int flags) /* If no copy then just increase the reference count and return the input */ else { - if ((flags & ENSUREARRAY) && \ - (subtype != &PyBigArray_Type)) { + if ((flags & ENSUREARRAY)) { Py_DECREF(newtype); Py_INCREF(arr->descr); ret = (PyArrayObject *) \ @@ -5864,8 +5844,7 @@ PyArray_FromArray(PyArrayObject *arr, PyArray_Descr *newtype, int flags) PyErr_SetString(PyExc_ValueError, msg); return NULL; } - if ((flags & ENSUREARRAY) && \ - (subtype != &PyBigArray_Type)) { + if ((flags & ENSUREARRAY)) { subtype = &PyArray_Type; } ret = (PyArrayObject *)\ @@ -6206,22 +6185,28 @@ PyArray_FromArrayAttr(PyObject *op, PyArray_Descr *typecode, PyObject *context) array_meth = PyObject_GetAttrString(op, "__array__"); if (array_meth == NULL) {PyErr_Clear(); return Py_NotImplemented;} if (context == NULL) { - if (typecode == NULL) new = PyObject_CallFunction(array_meth, NULL); + if (typecode == NULL) new = PyObject_CallFunction(array_meth, + NULL); else new = PyObject_CallFunction(array_meth, "O", typecode); } else { if (typecode == NULL) { - new = PyObject_CallFunction(array_meth, "OO", Py_None, context); - if (new == NULL && PyErr_ExceptionMatches(PyExc_TypeError)) { + new = PyObject_CallFunction(array_meth, "OO", Py_None, + context); + if (new == NULL && \ + PyErr_ExceptionMatches(PyExc_TypeError)) { PyErr_Clear(); new = PyObject_CallFunction(array_meth, ""); } } else { - new = PyObject_CallFunction(array_meth, "OO", typecode, context); - if (new == NULL && PyErr_ExceptionMatches(PyExc_TypeError)) { + new = PyObject_CallFunction(array_meth, "OO", + typecode, context); + if (new == NULL && \ + PyErr_ExceptionMatches(PyExc_TypeError)) { PyErr_Clear(); - new = PyObject_CallFunction(array_meth, "O", typecode); + new = PyObject_CallFunction(array_meth, "O", + typecode); } } } @@ -6266,7 +6251,8 @@ PyArray_FromAny(PyObject *op, PyArray_Descr *newtype, int min_depth, PyObject *new; if (r == NULL) return NULL; if (newtype != NULL || flags != 0) { - new = PyArray_FromArray((PyArrayObject *)r, newtype, flags); + new = PyArray_FromArray((PyArrayObject *)r, newtype, + flags); Py_DECREF(r); r = new; } @@ -6417,7 +6403,7 @@ PyArray_CheckFromAny(PyObject *op, PyArray_Descr *descr, int min_depth, ENSUREARRAY) */ /* that special cases Arrays and PyArray_Scalars up front */ /* It *steals a reference* to the object */ -/* It also guarantees that the result is PyArray_Type or PyBigArray_Type */ +/* It also guarantees that the result is PyArray_Type */ /* Because it decrefs op if any conversion needs to take place so it can be used like PyArray_EnsureArray(some_function(...)) */ @@ -6430,7 +6416,7 @@ PyArray_EnsureArray(PyObject *op) if (op == NULL) return NULL; - if (PyArray_CheckExact(op) || PyBigArray_CheckExact(op)) return op; + if (PyArray_CheckExact(op)) return op; if (PyArray_IsScalar(op, Generic)) { new = PyArray_FromScalar(op, NULL); diff --git a/numpy/core/src/multiarraymodule.c b/numpy/core/src/multiarraymodule.c index 14a7b8791..3e3f71527 100644 --- a/numpy/core/src/multiarraymodule.c +++ b/numpy/core/src/multiarraymodule.c @@ -4327,7 +4327,7 @@ _array_fromobject(PyObject *ignored, PyObject *args, PyObject *kws) return NULL; /* fast exit if simple call */ - if ((PyArray_CheckExact(op) || PyBigArray_CheckExact(op))) { + if (PyArray_CheckExact(op)) { if (type==NULL) { if (!copy && fortran==PyArray_ISFORTRAN(op)) { Py_INCREF(op); @@ -5831,25 +5831,6 @@ DL_EXPORT(void) initmultiarray(void) { d = PyModule_GetDict(m); if (!d) goto err; - /* Create the module and add the functions */ - if (PyType_Ready(&PyBigArray_Type) < 0) - return; - - PyArray_Type.tp_base = &PyBigArray_Type; - - PyArray_Type.tp_as_mapping = &array_as_mapping; - /* Even though, this would be inherited, it needs to be set now - so that the __getitem__ will map to the as_mapping descriptor - */ - PyArray_Type.tp_as_number = &array_as_number; - /* For good measure */ - PyArray_Type.tp_as_sequence = &array_as_sequence; - PyArray_Type.tp_as_buffer = &array_as_buffer; - PyArray_Type.tp_flags = (Py_TPFLAGS_DEFAULT - | Py_TPFLAGS_BASETYPE - | Py_TPFLAGS_CHECKTYPES); - PyArray_Type.tp_doc = Arraytype__doc__; - if (PyType_Ready(&PyArray_Type) < 0) return; @@ -5881,8 +5862,6 @@ DL_EXPORT(void) initmultiarray(void) { s = PyString_FromString("3.0"); PyDict_SetItemString(d, "__version__", s); Py_DECREF(s); - Py_INCREF(&PyBigArray_Type); - PyDict_SetItemString(d, "bigndarray", (PyObject *)&PyBigArray_Type); Py_INCREF(&PyArray_Type); PyDict_SetItemString(d, "ndarray", (PyObject *)&PyArray_Type); Py_INCREF(&PyArrayIter_Type); diff --git a/numpy/core/src/ufuncobject.c b/numpy/core/src/ufuncobject.c index f44a0114d..3083bb461 100644 --- a/numpy/core/src/ufuncobject.c +++ b/numpy/core/src/ufuncobject.c @@ -894,10 +894,6 @@ construct_matrices(PyUFuncLoopObject *loop, PyObject *args, PyArrayObject **mps) } else scalars[i] = PyArray_ScalarKind(arg_types[i], &(mps[i])); - /* If any input is a big-array */ - if (!PyType_IsSubtype(mps[i]->ob_type, &PyArray_Type)) { - subtype = &PyBigArray_Type; - } } /* If everything is a scalar, then use normal coercion rules */ @@ -921,7 +917,6 @@ construct_matrices(PyUFuncLoopObject *loop, PyObject *args, PyArrayObject **mps) (loop->ufunc->nin==2) && (loop->ufunc->nout == 1)) { PyObject *_obj = PyTuple_GET_ITEM(args, 1); if (!PyArray_CheckExact(_obj) && \ - !PyBigArray_CheckExact(_obj) && \ PyObject_HasAttrString(_obj, "__array_priority__") && \ _has_reflected_op(_obj, loop->ufunc->name)) { loop->notimplemented = 1; @@ -2536,7 +2531,7 @@ _find_array_wrap(PyObject *args, PyObject **output_wrap, int nin, int nout) nargs = PyTuple_GET_SIZE(args); for (i=0; i<nin; i++) { obj = PyTuple_GET_ITEM(args, i); - if (PyArray_CheckExact(obj) || PyBigArray_CheckExact(obj) || \ + if (PyArray_CheckExact(obj) || \ PyArray_IsAnyScalar(obj)) continue; wrap = PyObject_GetAttrString(obj, "__array_wrap__"); @@ -2596,8 +2591,7 @@ _find_array_wrap(PyObject *args, PyObject **output_wrap, int nin, int nout) obj = PyTuple_GET_ITEM(args, j); if (obj == Py_None) continue; - if (PyArray_CheckExact(obj) || - PyBigArray_CheckExact(obj)) { + if (PyArray_CheckExact(obj)) { output_wrap[i] = Py_None; } else { |