-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
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
ENH: raise early exception if 0d array is used in np.cross #24098
Conversation
Fixes #24079 |
numpy/core/numeric.py
Outdated
@@ -1581,6 +1581,10 @@ def cross(a, b, axisa=-1, axisb=-1, axisc=-1, axis=None): | |||
axisa, axisb, axisc = (axis,) * 3 | |||
a = asarray(a) | |||
b = asarray(b) | |||
|
|||
if (a.ndim < 1) or (b.ndim < 1): | |||
raise Exception("At least one array has zero dimension") |
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.
If you want to catch a ValueError, you need to use ValueError as an exception. Also, there is still a grammar error in the message.
raise Exception("At least one array has zero dimension") | |
raise ValueError("At least one array has zero dimensions") |
@mattip Made necessary changes. |
Thanks @DhavalParmar61 |
Looks like this should not be backported. |
Sorry, I didn't consider the implications of merging this vis-a-vis backporting. |
No description provided.