[Numpy-svn] r5680 - in trunk/numpy/core: . src
numpy-svn at scipy.org
numpy-svn at scipy.org
Sat Aug 23 18:52:57 EDT 2008
Author: oliphant
Date: 2008-08-23 17:52:55 -0500 (Sat, 23 Aug 2008)
New Revision: 5680
Modified:
trunk/numpy/core/memmap.py
trunk/numpy/core/src/scalarmathmodule.c.src
Log:
Trial fix to ticket #698
Modified: trunk/numpy/core/memmap.py
===================================================================
--- trunk/numpy/core/memmap.py 2008-08-23 21:18:47 UTC (rev 5679)
+++ trunk/numpy/core/memmap.py 2008-08-23 22:52:55 UTC (rev 5680)
@@ -219,6 +219,7 @@
self = ndarray.__new__(subtype, shape, dtype=descr, buffer=mm,
offset=offset, order=order)
self._mmap = mm
+# Should get rid of these... Are they used?
self._offset = offset
self._mode = mode
self._size = size
Modified: trunk/numpy/core/src/scalarmathmodule.c.src
===================================================================
--- trunk/numpy/core/src/scalarmathmodule.c.src 2008-08-23 21:18:47 UTC (rev 5679)
+++ trunk/numpy/core/src/scalarmathmodule.c.src 2008-08-23 22:52:55 UTC (rev 5680)
@@ -524,6 +524,13 @@
return -2;
}
+/**end repeat**/
+
+
+/**begin repeat
+ #name=byte,ubyte,short,ushort,int,uint,long,ulong,longlong,ulonglong,float,double,cfloat,cdouble#
+**/
+
static int
_ at name@_convert2_to_ctypes(PyObject *a, @name@ *arg1,
PyObject *b, @name@ *arg2)
@@ -539,6 +546,27 @@
/**end repeat**/
/**begin repeat
+ #name=longdouble, clongdouble#
+**/
+
+static int
+_ at name@_convert2_to_ctypes(PyObject *a, @name@ *arg1,
+ PyObject *b, @name@ *arg2)
+{
+ int ret;
+ ret = _ at name@_convert_to_ctype(a, arg1);
+ if (ret < 0) return ret;
+ ret = _ at name@_convert_to_ctype(b, arg2);
+ if (ret == -2) ret = -3;
+ if (ret < 0) return ret;
+ return 0;
+}
+
+/**end repeat**/
+
+
+
+/**begin repeat
#name=(byte,ubyte,short,ushort,int,uint,long,ulong,longlong,ulonglong)*13, (float, double, longdouble, cfloat, cdouble, clongdouble)*6, (float, double, longdouble)*2#
#Name=(Byte, UByte, Short, UShort, Int, UInt, Long, ULong, LongLong, ULongLong)*13, (Float, Double, LongDouble, CFloat, CDouble, CLongDouble)*6, (Float, Double, LongDouble)*2#
#oper=add*10, subtract*10, multiply*10, divide*10, remainder*10, divmod*10, floor_divide*10, lshift*10, rshift*10, and*10, or*10, xor*10, true_divide*10, add*6, subtract*6, multiply*6, divide*6, floor_divide*6, true_divide*6, divmod*3, remainder*3#
@@ -569,10 +597,14 @@
break;
case -1: /* one of them can't be cast safely
must be mixed-types*/
- return PyArray_Type.tp_as_number->nb_ at oper@(a,b);
+ return PyArray_Type.tp_as_number->nb_ at oper@(a,b);
case -2: /* use default handling */
if (PyErr_Occurred()) return NULL;
return PyGenericArrType_Type.tp_as_number->nb_ at oper@(a,b);
+ case -3: /* special case for longdouble and clongdouble
+ because they have a recursive getitem in their dtype */
+ Py_INCREF(Py_NotImplemented);
+ return Py_NotImplemented;
}
#if @fperr@
@@ -658,6 +690,10 @@
case -2: /* use default handling */
if (PyErr_Occurred()) return NULL;
return PyGenericArrType_Type.tp_as_number->nb_power(a,b,NULL);
+ case -3: /* special case for longdouble and clongdouble
+ because they have a recursive getitem in their dtype */
+ Py_INCREF(Py_NotImplemented);
+ return Py_NotImplemented;
}
PyUFunc_clearfperr();
@@ -887,6 +923,10 @@
case -2: /* use ufunc */
if (PyErr_Occurred()) return NULL;
return PyGenericArrType_Type.tp_richcompare(self, other, cmp_op);
+ case -3: /* special case for longdouble and clongdouble
+ because they have a recursive getitem in their dtype */
+ Py_INCREF(Py_NotImplemented);
+ return Py_NotImplemented;
}
/* here we do the actual calculation with arg1 and arg2 */
More information about the Numpy-svn
mailing list