[Numpy-svn] r3408 - trunk/numpy/core/src

numpy-svn at scipy.org numpy-svn at scipy.org
Fri Oct 27 15:43:04 CDT 2006


Author: oliphant
Date: 2006-10-27 15:43:01 -0500 (Fri, 27 Oct 2006)
New Revision: 3408

Modified:
   trunk/numpy/core/src/arrayobject.c
   trunk/numpy/core/src/scalartypes.inc.src
Log:
scalar value doesn't fail.

Modified: trunk/numpy/core/src/arrayobject.c
===================================================================
--- trunk/numpy/core/src/arrayobject.c	2006-10-27 20:41:58 UTC (rev 3407)
+++ trunk/numpy/core/src/arrayobject.c	2006-10-27 20:43:01 UTC (rev 3408)
@@ -1432,7 +1432,6 @@
         }
         else {
                 destptr = scalar_value(obj, descr);
-                if (destptr == NULL) {Py_DECREF(obj); return NULL;}
         }
         /* copyswap for OBJECT increments the reference count */
         copyswap(destptr, data, swap, base);

Modified: trunk/numpy/core/src/scalartypes.inc.src
===================================================================
--- trunk/numpy/core/src/scalartypes.inc.src	2006-10-27 20:41:58 UTC (rev 3407)
+++ trunk/numpy/core/src/scalartypes.inc.src	2006-10-27 20:43:01 UTC (rev 3408)
@@ -207,7 +207,6 @@
         castfunc = PyArray_GetCastFunc(indescr, outtype);
         if (castfunc == NULL) return -1;
         ptr = scalar_value(scalar, indescr);
-        if (ptr == NULL) return -1;
         castfunc(ptr, ctypeptr, 1, NULL, NULL);
         return 0;
 }
@@ -253,11 +252,6 @@
 
 
         memptr = scalar_value(scalar, typecode);
-        if (memptr == NULL) {
-                Py_XDECREF(outcode);
-                Py_DECREF(r);
-                return NULL;
-        }
         
 #ifndef Py_UNICODE_WIDE
         if (typecode->type_num == PyArray_UNICODE) {
@@ -883,7 +877,6 @@
                 void *ptr;
                 typecode = _realdescr_fromcomplexscalar(self, &typenum);
                 ptr = scalar_value(self, NULL);
-                if (ptr == NULL) {Py_DECREF(typecode); return NULL;}
                 ret = PyArray_Scalar(ptr, typecode, NULL);
                 Py_DECREF(typecode);
                 return ret;
@@ -909,10 +902,6 @@
                 char *ptr;
                 typecode = _realdescr_fromcomplexscalar(self, &typenum);
                 ptr = (char *)scalar_value(self, NULL);
-                if (ptr == NULL) {
-                        Py_DECREF(typecode);
-                        return NULL;
-                }
                 ret = PyArray_Scalar(ptr + typecode->elsize,
                                      typecode, NULL);
         }
@@ -1167,7 +1156,6 @@
                 if (!PyArray_ISNBO(self->descr->byteorder)) {
                         new = PyArray_DescrFromScalar(ret);
                         ptr = scalar_value(ret, new);
-                        if (ptr == NULL) {Py_DECREF(new); return NULL;}
                         byte_swap_vector(ptr, 1, new->elsize);
                         Py_DECREF(new);
                 }



More information about the Numpy-svn mailing list