summaryrefslogtreecommitdiff
path: root/numpy/core/src
diff options
context:
space:
mode:
Diffstat (limited to 'numpy/core/src')
-rw-r--r--numpy/core/src/_sortmodule.c.src2
-rw-r--r--numpy/core/src/arraymethods.c16
-rw-r--r--numpy/core/src/arrayobject.c70
-rw-r--r--numpy/core/src/arraytypes.inc.src4
-rw-r--r--numpy/core/src/multiarraymodule.c42
-rw-r--r--numpy/core/src/scalarmathmodule.c.src2
-rw-r--r--numpy/core/src/scalartypes.inc.src61
-rw-r--r--numpy/core/src/ufuncobject.c38
-rw-r--r--numpy/core/src/umathmodule.c.src2
9 files changed, 137 insertions, 100 deletions
diff --git a/numpy/core/src/_sortmodule.c.src b/numpy/core/src/_sortmodule.c.src
index a87a6858f..9ce5bb072 100644
--- a/numpy/core/src/_sortmodule.c.src
+++ b/numpy/core/src/_sortmodule.c.src
@@ -24,7 +24,7 @@
#include "Python.h"
-#include "numpy/arrayobject.h"
+#include "numpy/noprefix.h"
#define PYA_QS_STACK 100
#define SMALL_QUICKSORT 15
diff --git a/numpy/core/src/arraymethods.c b/numpy/core/src/arraymethods.c
index 352300779..833f5e5c0 100644
--- a/numpy/core/src/arraymethods.c
+++ b/numpy/core/src/arraymethods.c
@@ -272,7 +272,7 @@ PyArray_GetField(PyArrayObject *self, PyArray_Descr *typed, int offset)
Py_INCREF(self);
((PyArrayObject *)ret)->base = (PyObject *)self;
- PyArray_UpdateFlags((PyArrayObject *)ret, UPDATE_ALL_FLAGS);
+ PyArray_UpdateFlags((PyArrayObject *)ret, UPDATE_ALL);
return ret;
}
@@ -321,7 +321,7 @@ PyArray_SetField(PyArrayObject *self, PyArray_Descr *dtype,
Py_INCREF(self);
((PyArrayObject *)ret)->base = (PyObject *)self;
- PyArray_UpdateFlags((PyArrayObject *)ret, UPDATE_ALL_FLAGS);
+ PyArray_UpdateFlags((PyArrayObject *)ret, UPDATE_ALL);
retval = PyArray_CopyObject((PyArrayObject *)ret, val);
Py_DECREF(ret);
return retval;
@@ -1026,10 +1026,10 @@ array_setstate(PyArrayObject *self, PyObject *args)
}
}
- if ((self->flags & OWN_DATA)) {
+ if ((self->flags & OWNDATA)) {
if (self->data != NULL)
PyDataMem_FREE(self->data);
- self->flags &= ~OWN_DATA;
+ self->flags &= ~OWNDATA;
}
Py_XDECREF(self->base);
@@ -1040,7 +1040,7 @@ array_setstate(PyArrayObject *self, PyObject *args)
self->dimensions = NULL;
}
- self->flags = DEFAULT_FLAGS;
+ self->flags = DEFAULT;
self->nd = nd;
@@ -1085,7 +1085,7 @@ array_setstate(PyArrayObject *self, PyObject *args)
else {
memcpy(self->data, datastr, num);
}
- self->flags |= OWN_DATA;
+ self->flags |= OWNDATA;
self->base = NULL;
}
else {
@@ -1102,13 +1102,13 @@ array_setstate(PyArrayObject *self, PyObject *args)
return PyErr_NoMemory();
}
if (self->descr->hasobject) memset(self->data, 0, PyArray_NBYTES(self));
- self->flags |= OWN_DATA;
+ self->flags |= OWNDATA;
self->base = NULL;
if (_setlist_pkl(self, rawdata) < 0)
return NULL;
}
- PyArray_UpdateFlags(self, UPDATE_ALL_FLAGS);
+ PyArray_UpdateFlags(self, UPDATE_ALL);
Py_INCREF(Py_None);
return Py_None;
diff --git a/numpy/core/src/arrayobject.c b/numpy/core/src/arrayobject.c
index 09216039b..65ea47649 100644
--- a/numpy/core/src/arrayobject.c
+++ b/numpy/core/src/arrayobject.c
@@ -11,9 +11,7 @@ Heavily modified in 2005 with inspiration from Numarray
by
-Travis Oliphant
-Assistant Professor at
-Brigham Young University
+Travis Oliphant, oliphant@ee.byu.edu
maintainer email: oliphant.travis@ieee.org
@@ -93,7 +91,7 @@ PyArray_Zero(PyArrayObject *arr)
return zeroval;
}
storeflags = arr->flags;
- arr->flags |= BEHAVED_FLAGS;
+ arr->flags |= BEHAVED;
ret = arr->descr->f->setitem(obj, zeroval, arr);
arr->flags = storeflags;
Py_DECREF(obj);
@@ -129,7 +127,7 @@ PyArray_One(PyArrayObject *arr)
}
storeflags = arr->flags;
- arr->flags |= BEHAVED_FLAGS;
+ arr->flags |= BEHAVED;
ret = arr->descr->f->setitem(obj, oneval, arr);
arr->flags = storeflags;
Py_DECREF(obj);
@@ -1096,12 +1094,12 @@ PyArray_FromDimsAndDataAndDescr(int nd, int *d,
ret = PyArray_NewFromDescr(&PyArray_Type, descr,
nd, newd,
NULL, data,
- (data ? CARRAY_FLAGS : 0), NULL);
+ (data ? CARRAY : 0), NULL);
#else
ret = PyArray_NewFromDescr(&PyArray_Type, descr,
nd, (intp *)d,
NULL, data,
- (data ? CARRAY_FLAGS : 0), NULL);
+ (data ? CARRAY : 0), NULL);
#endif
return ret;
}
@@ -1270,7 +1268,7 @@ PyArray_Scalar(void *data, PyArray_Descr *descr, PyObject *base)
Py_INCREF(descr);
vobj->obval = NULL;
vobj->ob_size = itemsize;
- vobj->flags = BEHAVED_FLAGS | OWNDATA;
+ vobj->flags = BEHAVED | OWNDATA;
swap = 0;
if (descr->fields) {
if (base) {
@@ -1759,7 +1757,7 @@ array_dealloc(PyArrayObject *self) {
Py_DECREF(self->base);
}
- if ((self->flags & OWN_DATA) && self->data) {
+ if ((self->flags & OWNDATA) && self->data) {
/* Free internal references if an Object array */
if (self->descr->hasobject) {
Py_INCREF(self); /*hold on to self */
@@ -2476,7 +2474,7 @@ array_subscript_simple(PyArrayObject *self, PyObject *op)
other->base = (PyObject *)self;
Py_INCREF(self);
- PyArray_UpdateFlags(other, UPDATE_ALL_FLAGS);
+ PyArray_UpdateFlags(other, UPDATE_ALL);
return (PyObject *)other;
}
@@ -3727,7 +3725,7 @@ array_slice(PyArrayObject *self, Py_ssize_t ilow,
if (r == NULL) return NULL;
r->base = (PyObject *)self;
Py_INCREF(self);
- PyArray_UpdateFlags(r, UPDATE_ALL_FLAGS);
+ PyArray_UpdateFlags(r, UPDATE_ALL);
return (PyObject *)r;
}
@@ -3953,7 +3951,7 @@ array_str(PyArrayObject *self)
/*OBJECT_API
*/
static int
-PyArray_CompareUCS4(PyArray_UCS4 *s1, PyArray_UCS4 *s2, register size_t len)
+PyArray_CompareUCS4(npy_ucs4 *s1, npy_ucs4 *s2, register size_t len)
{
register PyArray_UCS4 c1, c2;
while(len-- > 0) {
@@ -4565,7 +4563,7 @@ _IsWriteable(PyArrayObject *ap)
int n;
/* If we own our own data, then no-problem */
- if ((base == NULL) || (ap->flags & OWN_DATA)) return TRUE;
+ if ((base == NULL) || (ap->flags & OWNDATA)) return TRUE;
/* Get to the final base object
If it is a writeable array, then return TRUE
@@ -4577,7 +4575,7 @@ _IsWriteable(PyArrayObject *ap)
*/
while(PyArray_Check(base)) {
- if (PyArray_CHKFLAGS(base, OWN_DATA))
+ if (PyArray_CHKFLAGS(base, OWNDATA))
return (Bool) (PyArray_ISWRITEABLE(base));
base = PyArray_BASE(base);
}
@@ -4636,7 +4634,7 @@ PyArray_UpdateFlags(PyArrayObject *ret, int flagmask)
else ret->flags &= ~ALIGNED;
}
/* This is not checked by default WRITEABLE is not
- part of UPDATE_ALL_FLAGS */
+ part of UPDATE_ALL */
if (flagmask & WRITEABLE) {
if (_IsWriteable(ret)) ret->flags |= WRITEABLE;
else ret->flags &= ~WRITEABLE;
@@ -4661,7 +4659,7 @@ PyArray_UpdateFlags(PyArrayObject *ret, int flagmask)
*/
/*OBJECT_API*/
-static unsigned char
+static Bool
PyArray_CheckStrides(int elsize, int nd, intp numbytes, intp offset,
intp *dims, intp *newstrides)
{
@@ -4696,7 +4694,7 @@ PyArray_CheckStrides(int elsize, int nd, intp numbytes, intp offset,
has the FORTRAN bit set, then a FORTRAN-style strides array will be
created (and of course the FORTRAN flag bit will be set).
- If data is not given but created here, then flags will be DEFAULT_FLAGS
+ If data is not given but created here, then flags will be DEFAULT
and a non-zero flags argument can be used to indicate a FORTRAN style
array is desired.
*/
@@ -4914,7 +4912,7 @@ PyArray_NewFromDescr(PyTypeObject *subtype, PyArray_Descr *descr, int nd,
self->dimensions = NULL;
self->data = NULL;
if (data == NULL) {
- self->flags = DEFAULT_FLAGS;
+ self->flags = DEFAULT;
if (flags) {
self->flags |= FORTRAN;
if (nd > 1) self->flags &= ~CONTIGUOUS;
@@ -4960,7 +4958,7 @@ PyArray_NewFromDescr(PyTypeObject *subtype, PyArray_Descr *descr, int nd,
PyErr_NoMemory();
goto fail;
}
- self->flags |= OWN_DATA;
+ self->flags |= OWNDATA;
/* It is bad to have unitialized OBJECT pointers */
/* which could also be sub-fields of a VOID array */
@@ -4977,7 +4975,7 @@ PyArray_NewFromDescr(PyTypeObject *subtype, PyArray_Descr *descr, int nd,
}
}
else {
- self->flags &= ~OWN_DATA; /* If data is passed in,
+ self->flags &= ~OWNDATA; /* If data is passed in,
this object won't own it
by default.
Caller must arrange for
@@ -5002,7 +5000,7 @@ PyArray_NewFromDescr(PyTypeObject *subtype, PyArray_Descr *descr, int nd,
if (strides != NULL) { /* did not allocate own data
or funny strides */
/* update flags before finalize function */
- PyArray_UpdateFlags(self, UPDATE_ALL_FLAGS);
+ PyArray_UpdateFlags(self, UPDATE_ALL);
}
if PyCObject_Check(func) {
PyArray_FinalizeFunc *cfunc;
@@ -5112,7 +5110,7 @@ PyArray_Resize(PyArrayObject *self, PyArray_Dims *newshape, int refcheck,
oldsize = PyArray_SIZE(self);
if (oldsize != newsize) {
- if (!(self->flags & OWN_DATA)) {
+ if (!(self->flags & OWNDATA)) {
PyErr_SetString(PyExc_ValueError,
"cannot resize this array: " \
"it does not own its data");
@@ -5449,7 +5447,7 @@ array_new(PyTypeObject *subtype, PyObject *args, PyObject *kwds)
offset + (char *)buffer.ptr,
buffer.flags, NULL);
if (ret == NULL) {descr=NULL; goto fail;}
- PyArray_UpdateFlags(ret, UPDATE_ALL_FLAGS);
+ PyArray_UpdateFlags(ret, UPDATE_ALL);
ret->base = buffer.base;
Py_INCREF(buffer.base);
}
@@ -5765,7 +5763,7 @@ array_data_set(PyArrayObject *self, PyObject *op)
"not enough data for array");
return -1;
}
- if (self->flags & OWN_DATA) {
+ if (self->flags & OWNDATA) {
PyArray_XDECREF(self);
PyDataMem_FREE(self->data);
}
@@ -5779,7 +5777,7 @@ array_data_set(PyArrayObject *self, PyObject *op)
Py_INCREF(op);
self->base = op;
self->data = buf;
- self->flags = CARRAY_FLAGS;
+ self->flags = CARRAY;
if (!writeable)
self->flags &= ~WRITEABLE;
return 0;
@@ -5911,7 +5909,7 @@ array_descr_set(PyArrayObject *self, PyObject *arg)
}
self->descr = newtype;
- PyArray_UpdateFlags(self, UPDATE_ALL_FLAGS);
+ PyArray_UpdateFlags(self, UPDATE_ALL);
return 0;
@@ -7415,7 +7413,7 @@ PyArray_FromStructInterface(PyObject *input)
Py_INCREF(input);
PyArray_BASE(r) = input;
Py_DECREF(attr);
- PyArray_UpdateFlags((PyArrayObject *)r, UPDATE_ALL_FLAGS);
+ PyArray_UpdateFlags((PyArrayObject *)r, UPDATE_ALL);
return r;
fail:
@@ -7439,7 +7437,7 @@ PyArray_FromInterface(PyObject *input)
int buffer_len;
int res, i, n;
intp dims[MAX_DIMS], strides[MAX_DIMS];
- int dataflags = BEHAVED_FLAGS;
+ int dataflags = BEHAVED;
/* Get the memory from __array_data__ and __array_offset__ */
/* Get the shape */
@@ -7565,7 +7563,7 @@ PyArray_FromInterface(PyObject *input)
memcpy(ret->strides, strides, n*sizeof(intp));
}
else PyErr_Clear();
- PyArray_UpdateFlags(ret, UPDATE_ALL_FLAGS);
+ PyArray_UpdateFlags(ret, UPDATE_ALL);
Py_DECREF(inter);
return (PyObject *)ret;
@@ -7776,9 +7774,9 @@ PyArray_ObjectType(PyObject *op, int minimum_type)
to guarantee CONTIGUOUS, ALIGNED and WRITEABLE
and therefore it is redundant to include those as well.
- BEHAVED_FLAGS == ALIGNED | WRITEABLE
- CARRAY_FLAGS = CONTIGUOUS | BEHAVED_FLAGS
- FARRAY_FLAGS = FORTRAN | BEHAVED_FLAGS
+ BEHAVED == ALIGNED | WRITEABLE
+ CARRAY = CONTIGUOUS | BEHAVED
+ FARRAY = FORTRAN | BEHAVED
FORTRAN can be set in the FLAGS to request a FORTRAN array.
Fortran arrays are always behaved (aligned,
@@ -7974,7 +7972,7 @@ PyArray_CanCastSafely(int fromtype, int totype)
/* leaves reference count alone --- cannot be NULL*/
/*OBJECT_API*/
-static unsigned char
+static Bool
PyArray_CanCastTo(PyArray_Descr *from, PyArray_Descr *to)
{
int fromtype=from->type_num;
@@ -8008,7 +8006,7 @@ PyArray_CanCastTo(PyArray_Descr *from, PyArray_Descr *to)
/*OBJECT_API
See if array scalars can be cast.
*/
-static unsigned char
+static Bool
PyArray_CanCastScalar(PyTypeObject *from, PyTypeObject *to)
{
int fromtype;
@@ -8620,7 +8618,7 @@ iter_ass_subscript(PyArrayIterObject *self, PyObject *ind, PyObject *val)
PyObject *new;
Py_INCREF(indtype);
new = PyArray_CheckFromAny(obj, indtype, 0, 0,
- FORCECAST | BEHAVED_NS_FLAGS, NULL);
+ FORCECAST | BEHAVED_NS, NULL);
Py_DECREF(obj);
obj = new;
if (new==NULL) goto finish;
@@ -9192,7 +9190,7 @@ _nonzero_indices(PyObject *myBool, PyArrayIterObject **iters)
typecode=PyArray_DescrFromType(PyArray_BOOL);
ba = (PyArrayObject *)PyArray_FromAny(myBool, typecode, 0, 0,
- CARRAY_FLAGS, NULL);
+ CARRAY, NULL);
if (ba == NULL) return -1;
nd = ba->nd;
for (j=0; j<nd; j++) iters[j] = NULL;
diff --git a/numpy/core/src/arraytypes.inc.src b/numpy/core/src/arraytypes.inc.src
index be8fa159d..228f511cf 100644
--- a/numpy/core/src/arraytypes.inc.src
+++ b/numpy/core/src/arraytypes.inc.src
@@ -446,7 +446,7 @@ VOID_getitem(char *ip, PyArrayObject *ap)
if (!ret) return NULL;
PyArray_BASE(ret) = (PyObject *)ap;
Py_INCREF(ap);
- PyArray_UpdateFlags((PyArrayObject *)ret, UPDATE_ALL_FLAGS);
+ PyArray_UpdateFlags((PyArrayObject *)ret, UPDATE_ALL);
return ret;
}
@@ -546,7 +546,7 @@ VOID_setitem(PyObject *op, char *ip, PyArrayObject *ap)
if (!ret) return -1;
PyArray_BASE(ret) = (PyObject *)ap;
Py_INCREF(ap);
- PyArray_UpdateFlags((PyArrayObject *)ret, UPDATE_ALL_FLAGS);
+ PyArray_UpdateFlags((PyArrayObject *)ret, UPDATE_ALL);
res = PyArray_CopyObject((PyArrayObject *)ret, op);
Py_DECREF(ret);
return res;
diff --git a/numpy/core/src/multiarraymodule.c b/numpy/core/src/multiarraymodule.c
index 08c065268..7077ff769 100644
--- a/numpy/core/src/multiarraymodule.c
+++ b/numpy/core/src/multiarraymodule.c
@@ -8,9 +8,7 @@
Modified extensively for numpy in 2005
Travis E. Oliphant
- Assistant Professor at
- Brigham Young University
-
+ oliphant@ee.byu.edu
*/
/* $Id: multiarraymodule.c,v 1.36 2005/09/14 00:14:00 teoliphant Exp $ */
@@ -23,7 +21,7 @@
*/
#define _MULTIARRAYMODULE
-#include "numpy/arrayobject.h"
+#include "numpy/noprefix.h"
#define PyAO PyArrayObject
@@ -585,7 +583,7 @@ PyArray_Squeeze(PyArrayObject *self)
self->flags,
(PyObject *)self);
if (ret == NULL) return NULL;
- PyArray_FLAGS(ret) &= ~OWN_DATA;
+ PyArray_FLAGS(ret) &= ~OWNDATA;
PyArray_BASE(ret) = (PyObject *)self;
Py_INCREF(self);
return (PyObject *)ret;
@@ -1124,7 +1122,7 @@ PyArray_AsCArray(PyObject **op, void *ptr, intp *dims, int nd,
return -1;
}
if ((ap = (PyArrayObject*)PyArray_FromAny(*op, typedescr, nd, nd,
- CARRAY_FLAGS, NULL)) == NULL)
+ CARRAY, NULL)) == NULL)
return -1;
switch(nd) {
case 1:
@@ -1504,7 +1502,7 @@ PyArray_Repeat(PyArrayObject *aop, PyObject *op, int axis)
nd = repeats->nd;
counts = (intp *)repeats->data;
- if ((ap=_check_axis(aop, &axis, CARRAY_FLAGS))==NULL) {
+ if ((ap=_check_axis(aop, &axis, CARRAY))==NULL) {
Py_DECREF(repeats);
return NULL;
}
@@ -1732,7 +1730,7 @@ PyArray_ConvertToCommonType(PyObject *op, int *retn)
}
/* Make sure all arrays are actual array objects. */
for(i=0; i<n; i++) {
- int flags = CARRAY_FLAGS;
+ int flags = CARRAY;
if ((otmp = PySequence_GetItem(op, i)) == NULL)
goto fail;
if (!allscalars && ((PyObject *)(mps[i]) == Py_None)) {
@@ -2108,7 +2106,7 @@ PyArray_Sort(PyArrayObject *op, int axis, PyArray_SORTKIND which)
ap = (PyArrayObject *)PyArray_FromAny((PyObject *)op,
NULL, 1, 0,
- DEFAULT_FLAGS | UPDATEIFCOPY, NULL);
+ DEFAULT | UPDATEIFCOPY, NULL);
if (ap == NULL) goto fail;
elsize = ap->descr->elsize;
@@ -2554,10 +2552,10 @@ PyArray_InnerProduct(PyObject *op1, PyObject *op2)
typec = PyArray_DescrFromType(typenum);
Py_INCREF(typec);
ap1 = (PyArrayObject *)PyArray_FromAny(op1, typec, 0, 0,
- BEHAVED_FLAGS, NULL);
+ BEHAVED, NULL);
if (ap1 == NULL) {Py_DECREF(typec); return NULL;}
ap2 = (PyArrayObject *)PyArray_FromAny(op2, typec, 0, 0,
- BEHAVED_FLAGS, NULL);
+ BEHAVED, NULL);
if (ap2 == NULL) goto fail;
if (ap1->nd == 0 || ap2->nd == 0) {
@@ -2662,10 +2660,10 @@ PyArray_MatrixProduct(PyObject *op1, PyObject *op2)
typec = PyArray_DescrFromType(typenum);
Py_INCREF(typec);
ap1 = (PyArrayObject *)PyArray_FromAny(op1, typec, 0, 0,
- BEHAVED_FLAGS, NULL);
+ BEHAVED, NULL);
if (ap1 == NULL) {Py_DECREF(typec); return NULL;}
ap2 = (PyArrayObject *)PyArray_FromAny(op2, typec, 0, 0,
- BEHAVED_FLAGS, NULL);
+ BEHAVED, NULL);
if (ap2 == NULL) goto fail;
if (ap1->nd == 0 || ap2->nd == 0) {
@@ -2772,7 +2770,7 @@ PyArray_CopyAndTranspose(PyObject *op)
char *optr;
/* make sure it is well-behaved */
- arr = PyArray_FromAny(op, NULL, 0, 0, CARRAY_FLAGS, NULL);
+ arr = PyArray_FromAny(op, NULL, 0, 0, CARRAY, NULL);
nd = PyArray_NDIM(arr);
if (nd == 1) { /* we will give in to old behavior */
ret = PyArray_Copy((PyArrayObject *)arr);
@@ -2838,10 +2836,10 @@ PyArray_Correlate(PyObject *op1, PyObject *op2, int mode)
typec = PyArray_DescrFromType(typenum);
Py_INCREF(typec);
ap1 = (PyArrayObject *)PyArray_FromAny(op1, typec, 1, 1,
- DEFAULT_FLAGS, NULL);
+ DEFAULT, NULL);
if (ap1 == NULL) {Py_DECREF(typec); return NULL;}
ap2 = (PyArrayObject *)PyArray_FromAny(op2, typec, 1, 1,
- DEFAULT_FLAGS, NULL);
+ DEFAULT, NULL);
if (ap2 == NULL) goto fail;
n1 = ap1->dimensions[0];
@@ -3107,7 +3105,7 @@ PyArray_Take(PyArrayObject *self0, PyObject *indices0, int axis)
char *src, *dest;
indices = ret = NULL;
- self = (PyAO *)_check_axis(self0, &axis, CARRAY_FLAGS);
+ self = (PyAO *)_check_axis(self0, &axis, CARRAY);
if (self == NULL) return NULL;
indices = (PyArrayObject *)PyArray_ContiguousFromAny(indices0,
@@ -3208,7 +3206,7 @@ PyArray_Put(PyArrayObject *self, PyObject* values0, PyObject *indices0)
thistype = self->descr->type_num;
Py_INCREF(self->descr);
values = (PyArrayObject *)PyArray_FromAny(values0, self->descr, 0, 0,
- DEFAULT_FLAGS | FORCECAST, NULL);
+ DEFAULT | FORCECAST, NULL);
if (values == NULL) goto fail;
nv = PyArray_SIZE(values);
if (nv > 0) { /* nv == 0 for a null array */
@@ -3282,7 +3280,7 @@ PyArray_PutMask(PyArrayObject *self, PyObject* values0, PyObject* mask0)
chunk = self->descr->elsize;
mask = (PyArrayObject *)\
- PyArray_FROM_OTF(mask0, PyArray_BOOL, CARRAY_FLAGS | FORCECAST);
+ PyArray_FROM_OTF(mask0, PyArray_BOOL, CARRAY | FORCECAST);
if (mask == NULL) goto fail;
ni = PyArray_SIZE(mask);
if (ni != max_item) {
@@ -3351,7 +3349,7 @@ PyArray_Converter(PyObject *object, PyObject **address)
return PY_SUCCEED;
}
else {
- *address = PyArray_FromAny(object, NULL, 0, 0, CARRAY_FLAGS, NULL);
+ *address = PyArray_FromAny(object, NULL, 0, 0, CARRAY, NULL);
if (*address == NULL) return PY_FAIL;
return PY_SUCCEED;
}
@@ -3548,7 +3546,7 @@ PyArray_BufferConverter(PyObject *obj, PyArray_Chunk *buf)
int buflen;
buf->ptr = NULL;
- buf->flags = BEHAVED_FLAGS;
+ buf->flags = BEHAVED;
buf->base = NULL;
if (obj == Py_None)
@@ -5431,7 +5429,7 @@ PyArray_FromBuffer(PyObject *buf, PyArray_Descr *type,
type,
1, &n,
NULL, data,
- DEFAULT_FLAGS,
+ DEFAULT,
NULL)) == NULL) {
Py_DECREF(buf);
return NULL;
diff --git a/numpy/core/src/scalarmathmodule.c.src b/numpy/core/src/scalarmathmodule.c.src
index 4abb3c29a..e514b083f 100644
--- a/numpy/core/src/scalarmathmodule.c.src
+++ b/numpy/core/src/scalarmathmodule.c.src
@@ -7,7 +7,7 @@
*/
#include "Python.h"
-#include "numpy/arrayobject.h"
+#include "numpy/noprefix.h"
#include "numpy/ufuncobject.h"
#include "numpy/arrayscalars.h"
diff --git a/numpy/core/src/scalartypes.inc.src b/numpy/core/src/scalartypes.inc.src
index 96accc4b2..983ef4bd8 100644
--- a/numpy/core/src/scalartypes.inc.src
+++ b/numpy/core/src/scalartypes.inc.src
@@ -92,7 +92,7 @@ PyArray_CastScalarToCtype(PyObject *scalar, void *ctypeptr,
outcode,
0, NULL,
NULL, ctypeptr,
- CARRAY_FLAGS, NULL);
+ CARRAY, NULL);
if (aout == NULL) {Py_DECREF(ain); return -1;}
castfunc(ain->data, aout->data, 1, ain, aout);
Py_DECREF(ain);
@@ -1186,7 +1186,7 @@ voidtype_setfield(PyVoidScalarObject *self, PyObject *args, PyObject *kwds)
}
else {
/* Copy data from value to correct place in dptr */
- src = PyArray_FromAny(value, typecode, 0, 0, CARRAY_FLAGS, NULL);
+ src = PyArray_FromAny(value, typecode, 0, 0, CARRAY, NULL);
if (src == NULL) return NULL;
typecode->f->copyswap(dptr, PyArray_DATA(src),
!PyArray_ISNBO(self->descr->byteorder),
@@ -1851,7 +1851,7 @@ void_arrtype_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
((PyVoidScalarObject *)ret)->descr = \
PyArray_DescrNewFromType(PyArray_VOID);
((PyVoidScalarObject *)ret)->descr->elsize = (int) memu;
- ((PyVoidScalarObject *)ret)->flags = BEHAVED_FLAGS | OWNDATA;
+ ((PyVoidScalarObject *)ret)->flags = BEHAVED | OWNDATA;
((PyVoidScalarObject *)ret)->base = NULL;
memset(destptr, '\0', (size_t) memu);
return ret;
@@ -2223,13 +2223,31 @@ static PyTypeObject Py@NAME@ArrType_Type = {
#name=int*5, uint*5, float*3#
#CNAME=(CHAR, SHORT, INT, LONG, LONGLONG)*2, FLOAT, DOUBLE, LONGDOUBLE#
*/
+#if BITSOF_@CNAME@ == 8
+#define _THIS_SIZE "8"
+#elif BITSOF_@CNAME@ == 16
+#define _THIS_SIZE "16"
+#elif BITSOF_@CNAME@ == 32
+#define _THIS_SIZE "32"
+#elif BITSOF_@CNAME@ == 64
+#define _THIS_SIZE "64"
+#elif BITSOF_@CNAME@ == 80
+#define _THIS_SIZE "80"
+#elif BITSOF_@CNAME@ == 96
+#define _THIS_SIZE "96"
+#elif BITSOF_@CNAME@ == 128
+#define _THIS_SIZE "128"
+#elif BITSOF_@CNAME@ == 256
+#define _THIS_SIZE "256"
+#endif
static PyTypeObject Py@NAME@ArrType_Type = {
PyObject_HEAD_INIT(NULL)
- 0, /*ob_size*/
- "@name@" STRBITSOF_@CNAME@ "scalar", /*tp_name*/
- sizeof(Py@NAME@ScalarObject), /*tp_basicsize*/
+ 0, /*ob_size*/
+ "@name@" _THIS_SIZE "scalar", /*tp_name*/
+ sizeof(Py@NAME@ScalarObject), /*tp_basicsize*/
};
+#undef _THIS_SIZE
/**end repeat**/
/**begin repeat
@@ -2237,10 +2255,32 @@ static PyTypeObject Py@NAME@ArrType_Type = {
#name=complex*3#
#CNAME=FLOAT, DOUBLE, LONGDOUBLE#
*/
+#if BITSOF_@CNAME@ == 16
+#define _THIS_SIZE2 "16"
+#define _THIS_SIZE1 "32"
+#elif BITSOF_@CNAME@ == 32
+#define _THIS_SIZE2 "32"
+#define _THIS_SIZE1 "64"
+#elif BITSOF_@CNAME@ == 64
+#define _THIS_SIZE2 "64"
+#define _THIS_SIZE1 "128"
+#elif BITSOF_@CNAME@ == 80
+#define _THIS_SIZE2 "80"
+#define _THIS_SIZE1 "160"
+#elif BITSOF_@CNAME@ == 96
+#define _THIS_SIZE2 "96"
+#define _THIS_SIZE1 "192"
+#elif BITSOF_@CNAME@ == 128
+#define _THIS_SIZE2 "128"
+#define _THIS_SIZE1 "256"
+#elif BITSOF_@CNAME@ == 256
+#define _THIS_SIZE2 "256"
+#define _THIS_SIZE1 "512"
+#endif
static PyTypeObject Py@NAME@ArrType_Type = {
PyObject_HEAD_INIT(NULL)
- 0, /*ob_size*/
- "@name@" STRBITSOF_C@CNAME@ "scalar", /*tp_name*/
+ 0, /*ob_size*/
+ "@name@" _THIS_SIZE1 "scalar", /*tp_name*/
sizeof(Py@NAME@ScalarObject), /*tp_basicsize*/
0, /*tp_itemsize*/
0, /*tp_dealloc*/
@@ -2259,12 +2299,15 @@ static PyTypeObject Py@NAME@ArrType_Type = {
0, /*tp_setattro*/
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT, /*tp_flags*/
- "Composed of two " STRBITSOF_@CNAME@ " bit floats", /* tp_doc */
+ "Composed of two " _THIS_SIZE2 " bit floats", /* tp_doc */
};
+#undef _THIS_SIZE1
+#undef _THIS_SIZE2
/**end repeat**/
+
static PyNumberMethods longdoubletype_as_number;
static PyNumberMethods clongdoubletype_as_number;
diff --git a/numpy/core/src/ufuncobject.c b/numpy/core/src/ufuncobject.c
index cf6140e10..8e7e2a159 100644
--- a/numpy/core/src/ufuncobject.c
+++ b/numpy/core/src/ufuncobject.c
@@ -7,9 +7,7 @@
This supports mathematical (and Boolean) functions on arrays and other python
objects. Math on large arrays of basic C types is rather efficient.
- Travis E. Oliphant (2005)
- Assistant Professor
- Brigham Young University
+ Travis E. Oliphant (2005-2006), oliphant@ee.byu.edu (oliphant.travis@ieee.org)
based on the
@@ -410,7 +408,7 @@ PyUFunc_On_Om(char **args, intp *dimensions, intp *steps, void *func)
int nin = data->nin, nout=data->nout;
int ntot;
PyObject *tocall = data->callable;
- char *ptrs[MAX_ARGS];
+ char *ptrs[NPY_MAXARGS];
PyObject *arglist, *result;
PyObject *in, **op;
@@ -880,8 +878,8 @@ static int
construct_matrices(PyUFuncLoopObject *loop, PyObject *args, PyArrayObject **mps)
{
int nargs, i, maxsize;
- int arg_types[MAX_ARGS];
- PyArray_SCALARKIND scalars[MAX_ARGS];
+ int arg_types[NPY_MAXARGS];
+ PyArray_SCALARKIND scalars[NPY_MAXARGS];
PyUFuncObject *self=loop->ufunc;
Bool allscalars=TRUE;
PyTypeObject *subtype=&PyArray_Type;
@@ -1471,26 +1469,26 @@ PyUFunc_GenericFunction(PyUFuncObject *self, PyObject *args,
}
break;
case BUFFER_UFUNCLOOP: {
- PyArray_CopySwapNFunc *copyswapn[MAX_ARGS];
+ PyArray_CopySwapNFunc *copyswapn[NPY_MAXARGS];
PyArrayIterObject **iters=loop->iters;
int *swap=loop->swap;
char **dptr=loop->dptr;
- int mpselsize[MAX_ARGS];
- intp laststrides[MAX_ARGS];
- int fastmemcpy[MAX_ARGS];
+ int mpselsize[NPY_MAXARGS];
+ intp laststrides[NPY_MAXARGS];
+ int fastmemcpy[NPY_MAXARGS];
int *needbuffer=loop->needbuffer;
intp index=loop->index, size=loop->size;
int bufsize;
intp bufcnt;
- int copysizes[MAX_ARGS];
+ int copysizes[NPY_MAXARGS];
char **bufptr = loop->bufptr;
char **buffer = loop->buffer;
char **castbuf = loop->castbuf;
intp *steps = loop->steps;
- char *tptr[MAX_ARGS];
+ char *tptr[NPY_MAXARGS];
int ninnerloops = loop->ninnerloops;
- Bool pyobject[MAX_ARGS];
- int datasize[MAX_ARGS];
+ Bool pyobject[NPY_MAXARGS];
+ int datasize[NPY_MAXARGS];
int i, j, k, stopcondition;
char *myptr1, *myptr2;
@@ -1718,7 +1716,7 @@ _getidentity(PyUFuncObject *self, int otype, char *str)
}
typecode = PyArray_DescrFromType(otype);
- arr = PyArray_FromAny(obj, typecode, 0, 0, CARRAY_FLAGS, NULL);
+ arr = PyArray_FromAny(obj, typecode, 0, 0, CARRAY, NULL);
Py_DECREF(obj);
return (PyArrayObject *)arr;
}
@@ -2465,7 +2463,7 @@ PyUFunc_GenericReduction(PyUFuncObject *self, PyObject *args,
PyArray_DescrConverter2,
&otype)) return NULL;
indices = (PyArrayObject *)PyArray_FromAny(obj_ind, indtype,
- 1, 1, CARRAY_FLAGS, NULL);
+ 1, 1, CARRAY, NULL);
if (indices == NULL) return NULL;
}
else {
@@ -2584,7 +2582,7 @@ _find_array_wrap(PyObject *args, PyObject **output_wrap, int nin, int nout)
int nargs, i;
int np = 0;
double priority, maxpriority;
- PyObject *with_wrap[MAX_ARGS], *wraps[MAX_ARGS];
+ PyObject *with_wrap[NPY_MAXARGS], *wraps[NPY_MAXARGS];
PyObject *obj, *wrap = NULL;
nargs = PyTuple_GET_SIZE(args);
@@ -2681,9 +2679,9 @@ ufunc_generic_call(PyUFuncObject *self, PyObject *args)
{
int i;
PyTupleObject *ret;
- PyArrayObject *mps[MAX_ARGS];
- PyObject *retobj[MAX_ARGS];
- PyObject *wraparr[MAX_ARGS];
+ PyArrayObject *mps[NPY_MAXARGS];
+ PyObject *retobj[NPY_MAXARGS];
+ PyObject *wraparr[NPY_MAXARGS];
PyObject *res;
int errval;
diff --git a/numpy/core/src/umathmodule.c.src b/numpy/core/src/umathmodule.c.src
index d5fc5872e..059538981 100644
--- a/numpy/core/src/umathmodule.c.src
+++ b/numpy/core/src/umathmodule.c.src
@@ -1,7 +1,7 @@
/* -*- c -*- */
#include "Python.h"
-#include "numpy/arrayobject.h"
+#include "numpy/noprefix.h"
#define _UMATHMODULE
#include "numpy/ufuncobject.h"
#include "abstract.h"