[pypy-issue] [issue1112] numpypy swapaxes patch

mikefc tracker at bugs.pypy.org
Wed Apr 11 14:05:39 CEST 2012


mikefc <coolbutuseless at gmail.com> added the comment:

New patch attached

>> * Can you add tests for doing this on slices and virtual arrays?
I'm not entirely certain how to do this, so I added what I think are tests to cover 
these. Can someone check?

>> * You don't need a loop in there, strides = concrete.strides[:] (etc.) should be 
enough.
Fixed.

>> * Can you bring in numpy.swapaxes into lib_pypy/numpypy/, should just be a copy-
paste from upstream numpy?
Added.  The numpy code does this:
    try:
        swapaxes = a.swapaxes
    except AttributeError:
        return _wrapit(a, 'swapaxes', axis1, axis2)
    return swapaxes(axis1, axis2)

Since numpypy works a bit differently, I don't think we have/need the _wrapit(), so I 
just did the following so it looks similar.
  swapaxes = a.swapaxes
  return swapaxes(axis1, axis2)

________________________________________
PyPy bug tracker <tracker at bugs.pypy.org>
<https://bugs.pypy.org/issue1112>
________________________________________


More information about the pypy-issue mailing list