Repository navigation
BUG: ensure out=None is never passed on to __array_ufunc__. - #12
Conversation
There was a problem hiding this comment.
np.modf(a, out=None) would be good here too
There was a problem hiding this comment.
I haven't included that since it is deprecated to give an explicit out argument which is not a tuple for nout=2:
In [2]: np.modf(1., out=None)
/usr/bin/ipython3:1: DeprecationWarning: passing a single array to the 'out' keyword argument of a ufunc with
more than one output will result in an error in the future
There was a problem hiding this comment.
Until it's removed, I think that we need to continue to support it, which includes having a test-case here.
There was a problem hiding this comment.
Does np.modf(a, b) get normalized to __array_ufunc__(..., out=(b, None)) here?
There was a problem hiding this comment.
Yes, the tuple is guaranteed to have the right number of elements.
f34fb60 to
9e7a318
Compare
|
@eric-wieser - well, that little comment of yours triggered a big avalanche: turns out there was very little checking that arguments were in fact correct. This was code from before I started to work on it, and I had hoped to leave it alone... Anyway, this now is a substantially larger PR, with a lot of extra tests; I hope you can have another look... |
There was a problem hiding this comment.
What am I missing here - can't we use ufunc->nin and ->nout?
There was a problem hiding this comment.
Not as long as we're passing np.dot and np.matmul through here... I think I should start collecting to-do clean-up items...
There was a problem hiding this comment.
If we're passing non-ufuncs in, then we should change the signature to PyObject* to make it clear that no properties can be depended on.
There was a problem hiding this comment.
I'm going to add a big warning note for now: this is outside of the scope of this should-have-been-small fix -- but I'll also mention it as a possible issue in the main thread.
There was a problem hiding this comment.
I'm somewhat concerned that upcasting a pointer is allowed to (although practically, will not) invoke undefined behaviour in a C compiler, so I think it's very important we change that to PyObject* until we work out a better way to indicate matmul and dot
9e159d9 to
ffc836a
Compare
|
Why are there 18 commits here? Looks like a merge was done instead of a rebase. |
|
I think this is because #11 was merged. Anyway, I'll fix. |
As part of this, it turns out the number of output arguments nout was needed, so that was passed in. Also, testing showed that arguments passed in both as positional and keyword arguments were not caught, so a duplication check was added.
9e7a318 to
63c911d
Compare
|
OK, the |
|
I think what happened is that I rebased the main PR after merging #11. |
|
Let's get it all together, thanks Marten. |
commit 9c833bed5879d77e625556260690c349de18b433 Author: Thomas Li <[email protected]> Date: Wed Nov 17 16:21:27 2021 -0800 Add Windows config to GHA update script [wheel build] typo [wheel build] fix typo? [wheel build] fix linux builds? [wheel build] typo [wheel build] add license and pin to windows 2016 skip tests [wheel build] pin to windows 2019 instead [wheel build] try to find out the error on windows [wheel build] maybe fix? [wheel build] maybe fix? [wheel build] fix? [wheel build] cleanup [wheel build] Add Windows config to GHA update script [wheel build] typo [wheel build] fix typo? [wheel build] fix linux builds? [wheel build] typo [wheel build] add license and pin to windows 2016 skip tests [wheel build] pin to windows 2019 instead [wheel build] try to find out the error on windows [wheel build] maybe fix? [wheel build] maybe fix? [wheel build] fix? [wheel build] cleanup [wheel build] Update LICENSE_win32.txt Update LICENSE_win32.txt Add Windows config to GHA update script [wheel build] typo [wheel build] fix typo? [wheel build] fix linux builds? [wheel build] typo [wheel build] add license and pin to windows 2016 skip tests [wheel build] pin to windows 2019 instead [wheel build] try to find out the error on windows [wheel build] maybe fix? [wheel build] maybe fix? [wheel build] fix? [wheel build] cleanup [wheel build] Update LICENSE_win32.txt Update LICENSE_win32.txt Update cibw_test_command.sh commit 4bd12df Author: Thomas Li <[email protected]> Date: Mon Nov 15 17:28:47 2021 -0800 # This is a combination of 14 commits. # This is the 1st commit message: Add Windows config to GHA # This is the commit message #2: update script [wheel build] # This is the commit message #3: typo [wheel build] # This is the commit message #4: fix typo? [wheel build] # This is the commit message #5: fix linux builds? [wheel build] # This is the commit message #6: typo [wheel build] # This is the commit message #7: add license and pin to windows 2016 # This is the commit message #8: skip tests [wheel build] # This is the commit message #9: pin to windows 2019 instead [wheel build] # This is the commit message #10: try to find out the error on windows [wheel build] # This is the commit message #11: maybe fix? [wheel build] # This is the commit message #12: maybe fix? [wheel build] # This is the commit message #13: fix? [wheel build] # This is the commit message #14: cleanup [wheel build]
A fix to a problem pointed out by @eric-wieser, where a single
Nonecould end up being present in theoutkeyword argument. I think this is fine to just merge (it adds some tests too).