summaryrefslogtreecommitdiff
path: root/numpy/core/src/arrayobject.c
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2008-07-13 18:19:16 +0000
committerCharles Harris <charlesr.harris@gmail.com>2008-07-13 18:19:16 +0000
commit303069205c70a1b9d9fddbeec25d839244588d32 (patch)
treea33f59a0a60bda15e71a5f1cca14e5c1b1671e9b /numpy/core/src/arrayobject.c
parent1dc6cce5b9cbd236777acc73fd9c73615b1d0ba2 (diff)
downloadnumpy-303069205c70a1b9d9fddbeec25d839244588d32.tar.gz
Deprecate PyArray_FromDims and PyArray_FromDimsAndDataAndDescr.
There will be warnings issued in np.test() until fftpack is fixed.
Diffstat (limited to 'numpy/core/src/arrayobject.c')
-rw-r--r--numpy/core/src/arrayobject.c36
1 files changed, 21 insertions, 15 deletions
diff --git a/numpy/core/src/arrayobject.c b/numpy/core/src/arrayobject.c
index 2ad4783d9..72e0bebbe 100644
--- a/numpy/core/src/arrayobject.c
+++ b/numpy/core/src/arrayobject.c
@@ -1311,26 +1311,24 @@ PyArray_FromDimsAndDataAndDescr(int nd, int *d,
char *data)
{
PyObject *ret;
-#if SIZEOF_INTP != SIZEOF_INT
int i;
intp newd[MAX_DIMS];
-#endif
+ char msg[] = "PyArray_FromDimsAndDataAndDescr";
+ int err;
+ err = PyErr_WarnEx(PyExc_DeprecationWarning, msg, 1);
+ if (err < 0) {
+ return NULL;
+ }
if (!PyArray_ISNBO(descr->byteorder))
descr->byteorder = '=';
-
-#if SIZEOF_INTP != SIZEOF_INT
- for(i=0; i<nd; i++) newd[i] = (intp) d[i];
+ for(i = 0; i < nd; i++) {
+ newd[i] = (intp) d[i];
+ }
ret = PyArray_NewFromDescr(&PyArray_Type, descr,
nd, newd,
NULL, data,
(data ? CARRAY : 0), NULL);
-#else
- ret = PyArray_NewFromDescr(&PyArray_Type, descr,
- nd, (intp *)d,
- NULL, data,
- (data ? CARRAY : 0), NULL);
-#endif
return ret;
}
@@ -1341,13 +1339,21 @@ static PyObject *
PyArray_FromDims(int nd, int *d, int type)
{
PyObject *ret;
+ char msg[] = "PyArray_FromDims";
+ int err;
+
+ err = PyErr_WarnEx(PyExc_DeprecationWarning, msg, 1);
+ if (err < 0) {
+ return NULL;
+ }
ret = PyArray_FromDimsAndDataAndDescr(nd, d,
PyArray_DescrFromType(type),
NULL);
- /* Old FromDims set memory to zero --- some algorithms
- relied on that. Better keep it the same. If
- Object type, then it's already been set to zero, though.
- */
+ /*
+ * Old FromDims set memory to zero --- some algorithms
+ * relied on that. Better keep it the same. If
+ * Object type, then it's already been set to zero, though.
+ */
if (ret && (PyArray_DESCR(ret)->type_num != PyArray_OBJECT)) {
memset(PyArray_DATA(ret), 0, PyArray_NBYTES(ret));
}