[Numpy-svn] r3245 - trunk/numpy/core
numpy-svn at scipy.org
numpy-svn at scipy.org
Mon Oct 2 18:51:09 EDT 2006
Author: oliphant
Date: 2006-10-02 17:51:07 -0500 (Mon, 02 Oct 2006)
New Revision: 3245
Modified:
trunk/numpy/core/records.py
Log:
Use sb.array to handle the array interface.
Modified: trunk/numpy/core/records.py
===================================================================
--- trunk/numpy/core/records.py 2006-10-02 22:48:14 UTC (rev 3244)
+++ trunk/numpy/core/records.py 2006-10-02 22:51:07 UTC (rev 3245)
@@ -522,9 +522,10 @@
interface = getattr(obj, "__array_interface__", None)
if interface is None or not isinstance(interface, dict):
raise ValueError("Unknown input type")
- dtype = interface.get("descr", None) or interface.get("typestr")
- shape = interface.get("shape")
- strides = interface.get("strides", None)
- return recarray(shape, dtype, buf=obj, offset=offset, strides=strides)
-
-
+ obj = sb.array(obj)
+ if dtype is not None and (obj.dtype != dtype):
+ obj = obj.view(dtype)
+ res = obj.view(recarray)
+ if issubclass(res.dtype.type, nt.void):
+ res.dtype = sb.dtype((record, res.dtype))
+ return res
More information about the Numpy-svn
mailing list