diff options
Diffstat (limited to 'scipy/base/src')
-rw-r--r-- | scipy/base/src/arraymethods.c | 11 | ||||
-rw-r--r-- | scipy/base/src/arrayobject.c | 6 | ||||
-rw-r--r-- | scipy/base/src/ufuncobject.c | 6 |
3 files changed, 12 insertions, 11 deletions
diff --git a/scipy/base/src/arraymethods.c b/scipy/base/src/arraymethods.c index 0cca98896..089aedf23 100644 --- a/scipy/base/src/arraymethods.c +++ b/scipy/base/src/arraymethods.c @@ -863,19 +863,18 @@ array_reduce(PyArrayObject *self, PyObject *args) ret = PyTuple_New(3); if (ret == NULL) return NULL; - mod = PyImport_ImportModule("scipy.base.multiarray"); + mod = PyImport_ImportModule("scipy.base._internal"); if (mod == NULL) {Py_DECREF(ret); return NULL;} - obj = PyObject_GetAttrString(mod, "empty"); + obj = PyObject_GetAttrString(mod, "_reconstruct"); Py_DECREF(mod); - if (obj == NULL) {Py_DECREF(ret); return NULL;} PyTuple_SET_ITEM(ret, 0, obj); PyTuple_SET_ITEM(ret, 1, - Py_BuildValue("NNN", + Py_BuildValue("ONN", + (PyObject *)self->ob_type, Py_BuildValue("(N)", PyInt_FromLong(0)), PyObject_GetAttrString((PyObject *)self, - "dtypechar"), - PyInt_FromLong((long) self->descr->elsize))); + "dtypechar"))); /* Now fill in object's state. This is a tuple with 4 arguments diff --git a/scipy/base/src/arrayobject.c b/scipy/base/src/arrayobject.c index ba4d17762..2610fe59c 100644 --- a/scipy/base/src/arrayobject.c +++ b/scipy/base/src/arrayobject.c @@ -8047,7 +8047,7 @@ arraydescr_new(PyTypeObject *subtype, PyObject *args, PyObject *kwds) } if (!PyArray_DescrConverter(odescr, &conv)) return NULL; - /* Get a new copy of it */ + /* Get a new copy of it (so it can be changed in setstate) */ descr = PyArray_DescrNew(conv); Py_DECREF(conv); return (PyObject *)descr; @@ -8072,7 +8072,9 @@ arraydescr_reduce(PyArray_Descr *self, PyObject *args) Py_DECREF(mod); if (obj == NULL) {Py_DECREF(ret); return NULL;} PyTuple_SET_ITEM(ret, 0, obj); - if (PyTypeNum_ISUSERDEF(self->type_num)) { + if (PyTypeNum_ISUSERDEF(self->type_num) || \ + ((self->type_num == PyArray_VOID && \ + self->typeobj != &PyVoidArrType_Type))) { obj = (PyObject *)self->typeobj; Py_INCREF(obj); } diff --git a/scipy/base/src/ufuncobject.c b/scipy/base/src/ufuncobject.c index a3d508a7d..4cf5b9c41 100644 --- a/scipy/base/src/ufuncobject.c +++ b/scipy/base/src/ufuncobject.c @@ -1374,10 +1374,10 @@ _printcastbuf(PyUFuncLoopObject *loop, int bufnum) /* currently generic ufuncs cannot be built for use on flexible arrays. The cast functions in the generic loop would need to be fixed to pass - something besides NULL, NULL. + in something besides NULL, NULL. - Also the underlying ufunc loops would not know the array size unless - that were passed in as data. + Also the underlying ufunc loops would not know the element-size unless + that was passed in as data (which could be arranged). */ |