[pypy-commit] pypy default: allow transpose(None)
bdkearns
noreply at buildbot.pypy.org
Wed Oct 30 05:54:52 CET 2013
Author: Brian Kearns <bdkearns at gmail.com>
Branch:
Changeset: r67726:1606b5779bce
Date: 2013-10-30 00:53 -0400
http://bitbucket.org/pypy/pypy/changeset/1606b5779bce/
Log: allow transpose(None)
diff --git a/pypy/module/micronumpy/interp_numarray.py b/pypy/module/micronumpy/interp_numarray.py
--- a/pypy/module/micronumpy/interp_numarray.py
+++ b/pypy/module/micronumpy/interp_numarray.py
@@ -345,7 +345,8 @@
return W_NDimArray(self.implementation.transpose(self))
def descr_transpose(self, space, args_w):
- if len(args_w) != 0:
+ if not (len(args_w) == 0 or
+ len(args_w) == 1 and space.is_none(args_w[0])):
raise OperationError(space.w_NotImplementedError, space.wrap(
"axes unsupported for transpose"))
return self.descr_get_transpose(space)
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
@@ -2218,6 +2218,7 @@
b = a.T
assert(b[:, 0] == a[0, :]).all()
assert (a.transpose() == b).all()
+ assert (a.transpose(None) == b).all()
import sys
if '__pypy__' in sys.builtin_module_names:
raises(NotImplementedError, a.transpose, (1, 0, 2))
More information about the pypy-commit
mailing list