Author: Matti Picus <[email protected]>
Branch: python-numpy
Changeset: r60970:d617732c1123
Date: 2013-02-08 11:25 +0200
http://bitbucket.org/pypy/pypy/changeset/d617732c1123/
Log: merge from default
diff --git a/pypy/module/micronumpy/arrayimpl/concrete.py
b/pypy/module/micronumpy/arrayimpl/concrete.py
--- a/pypy/module/micronumpy/arrayimpl/concrete.py
+++ b/pypy/module/micronumpy/arrayimpl/concrete.py
@@ -275,6 +275,11 @@
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):
@@ -309,11 +314,6 @@
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
diff --git a/pypy/module/micronumpy/test/test_numarray.py
b/pypy/module/micronumpy/test/test_numarray.py
--- a/pypy/module/micronumpy/test/test_numarray.py
+++ b/pypy/module/micronumpy/test/test_numarray.py
@@ -1640,7 +1640,7 @@
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
@@ -1653,7 +1653,9 @@
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
diff --git a/rpython/annotator/description.py b/rpython/annotator/description.py
--- a/rpython/annotator/description.py
+++ b/rpython/annotator/description.py
@@ -497,8 +497,8 @@
# 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
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit