[Numpy-svn] r3604 - trunk/numpy/lib

numpy-svn at scipy.org numpy-svn at scipy.org
Mon Mar 26 18:13:30 EDT 2007


Author: oliphant
Date: 2007-03-26 17:13:28 -0500 (Mon, 26 Mar 2007)
New Revision: 3604

Modified:
   trunk/numpy/lib/function_base.py
Log:
Fix ticket #459

Modified: trunk/numpy/lib/function_base.py
===================================================================
--- trunk/numpy/lib/function_base.py	2007-03-26 21:41:45 UTC (rev 3603)
+++ trunk/numpy/lib/function_base.py	2007-03-26 22:13:28 UTC (rev 3604)
@@ -422,7 +422,10 @@
         pfac = asarray(1)
         for k in range(n2+1):
             pfac = pfac + asarray(choicelist[k])
-        S = S*ones(asarray(pfac).shape)
+        if type(S) in ScalarType:
+            S = S*ones(asarray(pfac).shape, type(S))
+        else:
+            S = S*ones(asarray(pfac).shape, S.dtype)
     return choose(S, tuple(choicelist))
 
 def _asarray1d(arr, copy=False):




More information about the Numpy-svn mailing list