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 compat with Numpy 1.24 #14193
Fix compat with Numpy 1.24 #14193
Conversation
The compat code added in astropy#14128 assumed the keepdims change would concern Numpy 1.25, but this change made it to Numpy 1.24.
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.
Ah, that would make sense! Approving, though obviously we need to check the tests!
Yes, it works! (At least on the first test). Aside, now that 1.24 is released, we probably should change |
@@ -587,7 +587,7 @@ def median(a, axis=None, out=None, **kwargs): | |||
|
|||
a = Masked(a) | |||
|
|||
if NUMPY_LT_1_25: | |||
if NUMPY_LT_1_24: |
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.
Hmm... What does this mean? An upstream patch that made it into 1.24rc was backed out last minute?
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.
Oh, no, wait... a patch that was not in 1.24rc got backported from 1.25.dev last minute?
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.
Indeed, I think so. Bit weird, but I'm not exactly sure where the were in the release schedule when I made my PR.
I also want to see if this will fix the cron jobs. Thanks! |
@astrofrog , probably want a 5.2.1 soon with this patch? |
@@ -1696,27 +1696,32 @@ def itemset(self, *args): | |||
self.view(np.ndarray).itemset(*(args[:-1] + (self._to_own_unit(args[-1]),))) | |||
|
|||
def tostring(self, order="C"): | |||
"""Not implemented, use ``.value.tostring()`` 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.
Hmm, it seems like there has been a change on how docstrings are inherited. How weird. Anyway, happy with this if it works!
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.
And not just happy if thjs works: this is actually an improvement, since now if someone does quantity.tostring?
in ipython, they get a useful docstring!
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.
The problem was a Sphinx reference error with frombuffer
from the docstring inherited from ndarray.tobytes
:
❯ pydoc numpy.ndarray.tobytes
...
See also
--------
frombuffer
Inverse of this operation, construct a 1-dimensional array from Python
bytes.
So adding our own docstring was the easy solution, and while doing that I tried to put a docstring that could be useful ;)
Link check failure is unrelated. I think I am satisfied if one of the two exotic arch jobs pass and I can cancel the other one since the last one always takes so long. Just want to make sure the stuff we using for the CI works. |
The error in the link check is:
There is indeed no |
OK, sorry about the linkcheck comment -- happy if that is unrelated! |
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.
Thank you!
This comment was marked as resolved.
This comment was marked as resolved.
Merge pull request astropy#14193 from saimn/fix-numpy124 Fix compat with Numpy 1.24 (cherry picked from commit f879fa8)
Should be |
Manual backport of #14193 to v5.0.x (Fix compat with Numpy 1.24)
…193-on-v5.2.x Backport PR #14193 on branch v5.2.x (Fix compat with Numpy 1.24)
Fix #14189
The compat code added in #14128 assumed the keepdims change (numpy/numpy#22721) would concern Numpy 1.25, but this change made it to Numpy 1.24 (numpy/numpy#22748).