-
-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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
Fix (some) non-tuple index warnings #8936
Conversation
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.
Changes look reasonable to me, +1 for merge
@@ -2546,7 +2546,7 @@ def __init__(self, shape): | |||
self._v = np.arange(np.prod(shape)).reshape(shape) | |||
|
|||
def __getitem__(self, idx): | |||
return self._v[idx] | |||
return self._v[tuple(idx)] |
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.
Might make more sense to let the error propagate here, and fix it at the caller instead
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.
Actually, I failed to trigger this warning with the numpy HEAD, so I've just reverted this change.
scipy/signal/signaltools.py
Outdated
@@ -488,7 +488,7 @@ def _reverse_and_conj(x): | |||
Reverse array `x` in all dimensions and perform the complex conjugate | |||
""" | |||
reverse = [slice(None, None, -1)] * x.ndim |
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.
Could just change this one to a tuple literal rather than a list
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.
OK, done
704a7c5
to
89e0c5b
Compare
Thanks @ev-br |
As a companion to gh-8879, fix the non-tuple index warnings in
signal
,interpolate
andstats
.