Repository navigation
ENH: Make swapaxes always return a view. Fixes #5260 - #5468
Conversation
There was a problem hiding this comment.
Any idea what the last argument does? It isn't documented... OK, looks like it is needed for __finalize__, can be NULL.
There was a problem hiding this comment.
I used the code in PyArray_Transpose, which is the next function after this, as a template. We could actually eliminate this fast path altogether and let PyArray_Transpose handle the degenerate case also. There will be some unnecessary overhead, but perhaps simplicity is a better tradeoff than performance here.
|
Hmm, looks like This PR affects the C-API, so that should be documented. I'm inclined to think of this as a buglet fix, as the documentation says it returns a view. It's hard to think of a case where it could cause problems that wasn't due to a user bug. |
|
Apart from that, LGTM ;) |
swapaxes now returns a view of the input array when the axes to swap are both the same, not the input array as it used to do. Fixes numpy#5260
67493f2 to
a7fdf04
Compare
|
Removed the fast path and added a C API remark to the release notes. |
ENH: Make swapaxes always return a view. Fixes #5260
|
Merged, thanks. BTW, I grepped for |
|
That would be a new C API function, right? |
|
Could be. It would be interesting to see how common it is in extension code. |
No description provided.