[Numpy-svn] r3388 - in trunk/numpy: . core/src core/tests

numpy-svn at scipy.org numpy-svn at scipy.org
Tue Oct 24 01:52:41 CDT 2006


Author: oliphant
Date: 2006-10-24 01:52:30 -0500 (Tue, 24 Oct 2006)
New Revision: 3388

Modified:
   trunk/numpy/core/src/multiarraymodule.c
   trunk/numpy/core/tests/test_defmatrix.py
   trunk/numpy/ctypeslib.py
Log:
Add warning for ctypes < 1.0.1 and fix test and add C_CONTIGUOUS and F_CONTIGUOUS to multiarray._flagdict

Modified: trunk/numpy/core/src/multiarraymodule.c
===================================================================
--- trunk/numpy/core/src/multiarraymodule.c	2006-10-23 23:17:22 UTC (rev 3387)
+++ trunk/numpy/core/src/multiarraymodule.c	2006-10-24 06:52:30 UTC (rev 3388)
@@ -7151,8 +7151,12 @@
         Py_DECREF(s);
         PyDict_SetItemString(newd, "FORTRAN", s=PyInt_FromLong(FORTRAN));
         Py_DECREF(s);
+        PyDict_SetItemString(newd, "F_CONTIGUOUS", s=PyInt_FromLong(FORTRAN));
+        Py_DECREF(s);
         PyDict_SetItemString(newd, "CONTIGUOUS", s=PyInt_FromLong(CONTIGUOUS));
         Py_DECREF(s);
+        PyDict_SetItemString(newd, "C_CONTIGUOUS", s=PyInt_FromLong(CONTIGUOUS));
+        Py_DECREF(s);
         PyDict_SetItemString(newd, "ALIGNED", s=PyInt_FromLong(ALIGNED));
         Py_DECREF(s);
 

Modified: trunk/numpy/core/tests/test_defmatrix.py
===================================================================
--- trunk/numpy/core/tests/test_defmatrix.py	2006-10-23 23:17:22 UTC (rev 3387)
+++ trunk/numpy/core/tests/test_defmatrix.py	2006-10-24 06:52:30 UTC (rev 3388)
@@ -145,7 +145,7 @@
             }
         excluded_methods = [
             'argmin', 'choose', 'dump', 'dumps', 'fill', 'getfield',
-            'getA', 'item', 'nonzero', 'put', 'putmask', 'resize',
+            'getA', 'getA1', 'item', 'nonzero', 'put', 'putmask', 'resize',
             'searchsorted', 'setflags', 'setfield', 'sort', 'take',
             'tofile', 'tolist', 'tostring', 'all', 'any', 'sum',
             'argmax', 'argmin', 'min', 'max', 'mean', 'var', 'ptp',

Modified: trunk/numpy/ctypeslib.py
===================================================================
--- trunk/numpy/ctypeslib.py	2006-10-23 23:17:22 UTC (rev 3387)
+++ trunk/numpy/ctypeslib.py	2006-10-24 06:52:30 UTC (rev 3388)
@@ -7,6 +7,10 @@
 
 try:
     import ctypes
+    if ctypes.__version__ < '1.0.1':
+        import warnings
+        warnings.warn("All features of ctypes interface may not work with " \
+                      "ctypes < 1.0.1")
 except ImportError:
     ctypes = None
 
@@ -91,14 +95,14 @@
     since several restrictions can be specified, which are verified
     upon calling the ctypes function.  These include data type
     (dtype), number of dimensions (ndim), shape and flags (e.g.
-    'CONTIGUOUS' or 'FORTRAN').  If a given array does not satisfy the
+    'C_CONTIGUOUS' or 'F_CONTIGUOUS').  If a given array does not satisfy the
     specified restrictions, a TypeError is raised.
     
     Example:
         
         clib.somefunc.argtypes = [ndpointer(dtype=float64,
                                             ndim=1,
-                                            flags='CONTIGUOUS')]
+                                            flags='C_CONTIGUOUS')]
         clib.somefunc(array([1,2,3],dtype=float64))
 
     """



More information about the Numpy-svn mailing list