Commits

mattip committed d617732 Merge

merge from default

  • Participants
  • Parent commits dbdfabb, 28bd310
  • Branches python-numpy

Comments (0)

Files changed (3)

pypy/module/micronumpy/arrayimpl/concrete.py

     def get_buffer(self, space):
         return ArrayBuffer(self)
 
+    def astype(self, space, dtype):
+        new_arr = W_NDimArray.from_shape(self.get_shape(), dtype)
+        loop.copy_from_to(self, new_arr.implementation, dtype)
+        return new_arr
+
 class ConcreteArrayNotOwning(BaseConcreteArray):
     def __init__(self, shape, dtype, order, strides, backstrides, storage):
 
     def argsort(self, space, w_axis):
         return argsort_array(self, space, w_axis)
 
-    def astype(self, space, dtype):
-        new_arr = W_NDimArray.from_shape(self.get_shape(), dtype)
-        loop.copy_from_to(self, new_arr.implementation, dtype)
-        return new_arr
-
     def base(self):
         return None
 

pypy/module/micronumpy/test/test_numarray.py

         assert _weakref.ref(a)
 
     def test_astype(self):
-        from _numpypy import array
+        from _numpypy import array, arange
         b = array(1).astype(float)
         assert b == 1
         assert b.dtype == float
         b = array([0, 1, 2], dtype=complex).astype(bool)
         assert (b == [False, True, True]).all()
         assert b.dtype == 'bool'
-
+        
+        a = arange(6, dtype='f4').reshape(2,3)
+        b = a.astype('i4')
 
     def test_base(self):
         from _numpypy import array

rpython/annotator/description.py

             # will do the right thing in s_get_value().
         if isinstance(value, staticmethod) and mixin:
             # make a new copy of staticmethod
-            value =  staticmethod(func_with_new_name(value.__func__,
-                                                     value.__func__.__name__))
+            func = value.__get__(42)
+            value =  staticmethod(func_with_new_name(func, func.__name__))
 
         if type(value) in MemberDescriptorTypes:
             # skip __slots__, showing up in the class as 'member' objects