summaryrefslogtreecommitdiff
path: root/numpy/core/src/arrayobject.c
diff options
context:
space:
mode:
authorTravis Oliphant <oliphant@enthought.com>2006-06-02 06:52:33 +0000
committerTravis Oliphant <oliphant@enthought.com>2006-06-02 06:52:33 +0000
commitaba0c68744443f55e8c133343f23d0a9f62e4a0c (patch)
tree4ebb4534eb695f32726475f69c0d10a096a5e491 /numpy/core/src/arrayobject.c
parent98533e5228e7517c530c2e131d281e0d4e071c5d (diff)
downloadnumpy-aba0c68744443f55e8c133343f23d0a9f62e4a0c.tar.gz
Improve registered ufuncs so that they can coerce data to and from user-defined data-types. Clean-up _SOFFSET_ macro. Make sure that user-defined types always succeed in CanCastSafely. This is a hack but there is currently no way to record this information.
Diffstat (limited to 'numpy/core/src/arrayobject.c')
-rw-r--r--numpy/core/src/arrayobject.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/numpy/core/src/arrayobject.c b/numpy/core/src/arrayobject.c
index 9fbffb3c3..5b51b5c15 100644
--- a/numpy/core/src/arrayobject.c
+++ b/numpy/core/src/arrayobject.c
@@ -1118,7 +1118,7 @@ PyArray_Scalar(void *data, PyArray_Descr *descr, PyObject *base)
}
}
else {
- destptr = _SOFFSET_(obj, type_num);
+ destptr = _SOFFSET_(obj);
}
/* copyswap for OBJECT increments the reference count */
copyswap(destptr, data, swap, base);
@@ -7186,6 +7186,12 @@ PyArray_CanCastTo(PyArray_Descr *from, PyArray_Descr *to)
stringified value of the object.
*/
}
+ if (!ret && (PyTypeNum_ISUSERDEF(fromtype) || \
+ PyTypeNum_ISUSERDEF(totype))) {
+ /* don't restrict casting to and from
+ additional data-types */
+ return TRUE;
+ }
return ret;
}