[Numpy-svn] r5682 - in branches/1.1.x/numpy/core: . src

numpy-svn@scip... numpy-svn@scip...
Sat Aug 23 18:21:41 CDT 2008


Author: cdavid
Date: 2008-08-23 18:21:40 -0500 (Sat, 23 Aug 2008)
New Revision: 5682

Modified:
   branches/1.1.x/numpy/core/memmap.py
   branches/1.1.x/numpy/core/src/scalarmathmodule.c.src
Log:
Backport fix to #698.

Modified: branches/1.1.x/numpy/core/memmap.py
===================================================================
--- branches/1.1.x/numpy/core/memmap.py	2008-08-23 23:17:23 UTC (rev 5681)
+++ branches/1.1.x/numpy/core/memmap.py	2008-08-23 23:21:40 UTC (rev 5682)
@@ -195,6 +195,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: branches/1.1.x/numpy/core/src/scalarmathmodule.c.src
===================================================================
--- branches/1.1.x/numpy/core/src/scalarmathmodule.c.src	2008-08-23 23:17:23 UTC (rev 5681)
+++ branches/1.1.x/numpy/core/src/scalarmathmodule.c.src	2008-08-23 23:21:40 UTC (rev 5682)
@@ -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
 _@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
+_@name@_convert2_to_ctypes(PyObject *a, @name@ *arg1,
+                           PyObject *b, @name@ *arg2)
+{
+    int ret;
+    ret = _@name@_convert_to_ctype(a, arg1);
+    if (ret < 0) return ret;
+    ret = _@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_@oper@(a,b);
+        return PyArray_Type.tp_as_number->nb_@oper@(a,b); 
     case -2: /* use default handling */
         if (PyErr_Occurred()) return NULL;
         return PyGenericArrType_Type.tp_as_number->nb_@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