Fixed kernel multiplication with numpy floats #2174#2652
Fixed kernel multiplication with numpy floats #2174#2652embray merged 1 commit intoastropy:masterfrom
Conversation
|
This fixes #2174 so 👍 to merge this before making the 0.4 branch. I didn't look in detail how it works, but would it be useful to add a test that covers line 193 in |
|
It looks like |
|
I've never seen anyone use |
|
As @cdeil suggested I removed |
|
@adonath - can you add a changelog entry? |
|
@adonath Nag about adding a changelog entry under the 0.4.1 section so I can merge this. If you don't have time I can maybe do it though. |
|
@embray Thanks for the reminder. I've added the changelog entry and rebased. Travis builds have passed. |
There was a problem hiding this comment.
Oh, sorry to nitpick this, but it looks like you've inserted tabs. Please just insert spaces such that it lines up the same way as other entries.
|
👍 |
Fixed kernel multiplication with numpy floats #2174
Fixed kernel multiplication with numpy floats #2174
This PR fixes the multiplication of kernels with numpy floats. The bug was not easy to spot. The problem was that the
__rmul__method of the kernel was not called, because the kernel has an__array__method implemented, which was used for the multiplication with numpy floats from the left. This behaviour is fixed now, by additionally implementing the__array_wrap__method, which checks for the context of the multiplication. Furthermore I added some regression tests.