summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTravis Oliphant <oliphant@enthought.com>2006-03-10 06:58:33 +0000
committerTravis Oliphant <oliphant@enthought.com>2006-03-10 06:58:33 +0000
commit33c9c5bf1e86d4a768d7b80ed9e53a3278fd0cf5 (patch)
tree955e7edaf1d1f0d395c2632135eee9212e55d570
parent15dea0280a1c9eaf6acfd488679ab60ca88671c0 (diff)
downloadnumpy-33c9c5bf1e86d4a768d7b80ed9e53a3278fd0cf5.tar.gz
Fixed SETITEM and GETITEM macros. Added __index__ support for array scalars of integer type for Python 2.5
-rw-r--r--numpy/core/blasdot/_dotblas.c2
-rw-r--r--numpy/core/include/numpy/arrayobject.h4
-rw-r--r--numpy/core/include/numpy/ufuncobject.h2
-rw-r--r--numpy/core/src/scalartypes.inc.src21
4 files changed, 24 insertions, 5 deletions
diff --git a/numpy/core/blasdot/_dotblas.c b/numpy/core/blasdot/_dotblas.c
index d1971fa0f..299d44692 100644
--- a/numpy/core/blasdot/_dotblas.c
+++ b/numpy/core/blasdot/_dotblas.c
@@ -163,7 +163,7 @@ dotblas_matrixproduct(PyObject *dummy, PyObject *args)
PyArrayObject *ap1, *ap2, *ret;
int j, l, lda, ldb, ldc;
int typenum, nd;
- intp ap1stride;
+ intp ap1stride=0;
intp dimensions[MAX_DIMS];
static const float oneF[2] = {1.0, 0.0};
static const float zeroF[2] = {0.0, 0.0};
diff --git a/numpy/core/include/numpy/arrayobject.h b/numpy/core/include/numpy/arrayobject.h
index c380b3837..3c3fe6b72 100644
--- a/numpy/core/include/numpy/arrayobject.h
+++ b/numpy/core/include/numpy/arrayobject.h
@@ -1264,10 +1264,10 @@ typedef struct {
#define PyArray_ITEMSIZE(obj) (((PyArrayObject *)(obj))->descr->elsize)
#define PyArray_TYPE(obj) (((PyArrayObject *)(obj))->descr->type_num)
#define PyArray_GETITEM(obj,itemptr) \
- ((PyArrayObject *)(obj))->descr->getitem((char *)itemptr, \
+ ((PyArrayObject *)(obj))->descr->f->getitem((char *)itemptr, \
(PyArrayObject *)obj);
#define PyArray_SETITEM(obj,itemptr,v) \
- (obj)->descr->setitem((PyObject *)v,(char *)(itemptr), \
+ (obj)->descr->f->setitem((PyObject *)v,(char *)(itemptr), \
(PyArrayObject *)(obj));
diff --git a/numpy/core/include/numpy/ufuncobject.h b/numpy/core/include/numpy/ufuncobject.h
index 84b8661c5..62faf49f0 100644
--- a/numpy/core/include/numpy/ufuncobject.h
+++ b/numpy/core/include/numpy/ufuncobject.h
@@ -248,7 +248,7 @@ typedef struct {
/* Solaris --------------------------------------------------------*/
/* --------ignoring SunOS ieee_flags approach, someone else can
** deal with that! */
-#elif defined(sun) || defined(__OpenBSD__) || defined(__FreeBSD__)
+#elif defined(sun) || defined(__BSD__)
#include <ieeefp.h>
#define UFUNC_CHECK_STATUS(ret) { \
diff --git a/numpy/core/src/scalartypes.inc.src b/numpy/core/src/scalartypes.inc.src
index b984cf81a..d9c08900a 100644
--- a/numpy/core/src/scalartypes.inc.src
+++ b/numpy/core/src/scalartypes.inc.src
@@ -635,6 +635,22 @@ static PyObject *
}
/**end repeat**/
+#if PY_VERSION_HEX >= 0x02050000
+/* This needs a better implementation */
+static Py_ssize_t
+gentype_index(PyObject *self)
+{
+ PyObject *obj;
+ if (!(PyArray_IsScalar(self, Integer))) {
+ PyErr_SetString(PyExc_TypeError,
+ "not an integer type.");
+ return -1;
+ }
+ obj = gentype_int(self);
+ if (obj == NULL) return -1;
+ return PyInt_AsSsize_t(obj);
+}
+#endif
static PyNumberMethods gentype_as_number = {
@@ -676,9 +692,12 @@ static PyNumberMethods gentype_as_number = {
(binaryfunc)gentype_true_divide, /*nb_true_divide*/
0, /*nb_inplace_floor_divide*/
0, /*nb_inplace_true_divide*/
-
+#if PY_VERSION_HEX >= 0x02050000
+ (lenfunc)gentype_index, /* nb_index */
+#endif
};
+
static PyObject *
gentype_richcompare(PyObject *self, PyObject *other, int cmp_op)
{