[Numpy-svn] r4241 - in trunk/numpy: core/include/numpy distutils lib

numpy-svn@scip... numpy-svn@scip...
Thu Oct 18 10:18:59 CDT 2007


Author: oliphant
Date: 2007-10-18 10:18:57 -0500 (Thu, 18 Oct 2007)
New Revision: 4241

Modified:
   trunk/numpy/core/include/numpy/ndarrayobject.h
   trunk/numpy/distutils/system_info.py
   trunk/numpy/lib/function_base.py
Log:
Fix vectorize to work with strings. Fix where 64-bit looks for X11 libraries. Fix comment.

Modified: trunk/numpy/core/include/numpy/ndarrayobject.h
===================================================================
--- trunk/numpy/core/include/numpy/ndarrayobject.h	2007-10-18 13:37:26 UTC (rev 4240)
+++ trunk/numpy/core/include/numpy/ndarrayobject.h	2007-10-18 15:18:57 UTC (rev 4241)
@@ -1282,7 +1282,7 @@
    and WRITEABLE. */
 #define NPY_ENSURECOPY    0x0020
 
-/* Make sure the returned array is an ndarray or a bigndarray */
+/* Make sure the returned array is a base-class ndarray */
 #define NPY_ENSUREARRAY   0x0040
 
 /* Make sure that the strides are in units of the element size

Modified: trunk/numpy/distutils/system_info.py
===================================================================
--- trunk/numpy/distutils/system_info.py	2007-10-18 13:37:26 UTC (rev 4240)
+++ trunk/numpy/distutils/system_info.py	2007-10-18 15:18:57 UTC (rev 4241)
@@ -143,7 +143,18 @@
                             '/opt/include', '/usr/include',
                             '/opt/local/include', '/sw/include']
     default_src_dirs = ['.','/usr/local/src', '/opt/src','/sw/src']
-    default_x11_lib_dirs = ['/usr/X11R6/lib','/usr/X11/lib','/usr/lib']
+
+    try:
+        platform = os.uname()
+        bit64 = platform[-1].endswith('64')
+    except:
+        bit64 = False
+
+    if bit64:
+        default_x11_lib_dirs = ['/usr/lib64']
+    else:
+        default_x11_lib_dirs = ['/usr/X11R6/lib','/usr/X11/lib','/usr/lib']
+
     default_x11_include_dirs = ['/usr/X11R6/include','/usr/X11/include',
                                 '/usr/include']
 

Modified: trunk/numpy/lib/function_base.py
===================================================================
--- trunk/numpy/lib/function_base.py	2007-10-18 13:37:26 UTC (rev 4240)
+++ trunk/numpy/lib/function_base.py	2007-10-18 15:18:57 UTC (rev 4241)
@@ -914,6 +914,7 @@
                 raise ValueError, "mismatch between python function inputs"\
                       " and received arguments"
 
+        # we need a new ufunc if this is being called with more arguments.
         if (self.lastcallargs != nargs):
             self.lastcallargs = nargs
             self.ufunc = None
@@ -935,14 +936,17 @@
                     otypes.append(asarray(theout[k]).dtype.char)
                 self.otypes = ''.join(otypes)
 
+        # Create ufunc if not already created
         if (self.ufunc is None):
             self.ufunc = frompyfunc(self.thefunc, nargs, self.nout)
 
+        # Convert to object arrays first
+        newargs = [asarray(arg,dtype=object) for arg in args]
         if self.nout == 1:
-            _res = array(self.ufunc(*args),copy=False).astype(self.otypes[0])
+            _res = array(self.ufunc(*newargs),copy=False).astype(self.otypes[0])
         else:
             _res = tuple([array(x,copy=False).astype(c) \
-                          for x, c in zip(self.ufunc(*args), self.otypes)])
+                          for x, c in zip(self.ufunc(*newargs), self.otypes)])
         return _res
 
 def cov(m, y=None, rowvar=1, bias=0):



More information about the Numpy-svn mailing list