-
-
Notifications
You must be signed in to change notification settings - Fork 9.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BUG: Fix segmentation fault #21436
BUG: Fix segmentation fault #21436
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -389,7 +389,7 @@ def test_signature8(self): | |
assert_equal(ixs, (0, 0, 0, 1, 2)) | ||
assert_equal(flags, (self.can_ignore, self.size_inferred, 0)) | ||
assert_equal(sizes, (3, -1, 9)) | ||
|
||
def test_signature9(self): | ||
enabled, num_dims, ixs, flags, sizes = umt.test_signature( | ||
1, 1, "( 3) -> ( )") | ||
|
@@ -2002,6 +2002,23 @@ def test_inplace_fancy_indexing(self): | |
# Test multiple output ufuncs raise error, gh-5665 | ||
assert_raises(ValueError, np.modf.at, np.arange(10), [1]) | ||
|
||
# Test ufuncs with non-trivial signature raise a TypeError | ||
a = np.ones((2, 2, 2)) | ||
b = np.ones((1, 2, 2)) | ||
assert_raises(TypeError, np.matmul.at, a, [0], b) | ||
|
||
a = np.array([[[1, 2], [3, 4]]]) | ||
assert_raises(TypeError, np.linalg._umath_linalg.det.at, a, [0]) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These tests look good. But single test functions getting too long tends to be inconvenient. Could you make a new method for these two? Could just be something mentioning that gufuncs don't support |
||
|
||
# Ufunc with None signature should work as intended | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess we should have tests for this already? So I think you can remove them again. |
||
a = np.array([1, 2, 3]) | ||
np.add.at(a, [0], 4) | ||
assert_equal(np.array([5, 2, 3]), a) | ||
|
||
a = np.array([1, 2, 3]) | ||
np.maximum.at(a, [0], 0) | ||
assert_equal(np.array([1, 2, 3]), a) | ||
|
||
def test_reduce_arguments(self): | ||
f = np.add.reduce | ||
d = np.ones((5,2), dtype=int) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a nit, but the
\
is not necessary :).We could probably make the error message friendlier by printing out the ufunc name rather than "numpy.ufunc.at". The name is far more interesting than the actual core signature!