Repository navigation
Conversation
|
Thank you for your contribution to Astropy! 🌌 This checklist is meant to remind the package maintainers who will review this pull request of some common things to look for.
|
|
👋 Thank you for your draft pull request! Do you know that you can use |
|
CI actually pass, which means none of our tests actually relies on the hack, so hopefully our users do not either 🤞🏻 |
astrofrog
left a comment
There was a problem hiding this comment.
This might indeed be the simplest approach, and we can revisit if users on Windows report issues again related to this?
|
Definitely. I should point out that this hack has been with us for 12 years so it's actually possible that some end users or even downstream packages have been unknowingly relying on it. |
mhvk
left a comment
There was a problem hiding this comment.
Yes, I remember the addition of the deprecation warning and not at all being sure even then it was actually needed. For now, this seems the most expedient route - hopefully, we either hear soon it is actually important or find out that it is not required at all.
|
Let's add a changelog entry so there is a(nother) place to find that something changed if someone runs into a segfault... |
4e0ba48 to
ff49ce9
Compare
|
changelog added ! |
|
@astrofrog Hopefully this can be backported now :) |
| @@ -0,0 +1 @@ | |||
| Skip an un-portable hack for Windows if NumPy 2.0 or newer is installed. | |||
There was a problem hiding this comment.
This is in the bugfix section, so as a user I would be very interested in under what circumstances I might encounter this hack. If we cannot figure out a situation where the hack is relevant then the change is not user-facing and should not be in the change log at all.
There was a problem hiding this comment.
I think the idea is that most readers wouldn't care but it's good to have an entry there to signal that we're aware of this change if anyone comes looking for it. Does it make sense ?
There was a problem hiding this comment.
The entry is so vague that it is impossible for users to know if they should care or not (if they are on Windows).
There was a problem hiding this comment.
Fair enough. How about:
Skip an un-portable hack in for Windows if NumPy 2.0 or newer is installed.
This fixes a crash that occurred for files oopened viafits.open(..., mode='update')
There was a problem hiding this comment.
Mentioning fits.open() and mode="update" looks like it might be specific enough, but if the hack can be accessed through the high-level unified I/O interface then that should be mentioned too.
There was a problem hiding this comment.
I don't know that it can. fits.open(..., mode="update") just seemed to be the common denominator for all 4 failing tests we had (see example logs)
ff49ce9 to
640ad04
Compare
|
I updated the changelog so it's hopefully more useful to users. This should go in the newly created v6.1.2 milestone |
|
The readthedocs failure cannot be related - presumably fixed by #16583 |
640ad04 to
2be96df
Compare
|
Alternatively, I just rebased now. |
| This fixes a crash that occurred for files oopened via | ||
| ``fits.open(..., mode='update')``. |
There was a problem hiding this comment.
Change log entries should describe to users what has changed in enough detail that looking up the actual code changes or any discussions on GitHub should not be required. If I try to read the two sentences here without any other context I get the question if skipping a hack fixes a crash then does that mean that the hack caused the crashes? If so then why was the hack there in the first place?
There was a problem hiding this comment.
does that mean that the hack caused the crashes ?
This would be the correct conclusion.
If so then why was the hack there in the first place?
It's already hard for us to know that. What would you suggest we say instead ?
There was a problem hiding this comment.
I'm not familiar with io.fits and I'm not familiar with Windows either, so I don't really know what to say. I'm just pointing out that the change log is meant to be for the benefit of the users so the entries should not confuse them.
There was a problem hiding this comment.
How about this ?
Fixed a crash that occurred for files opened via ``fits.open(..., mode='update')``,
on Windows, and with numpy 2.0 installed.
It is possible, though unlikely, that this patch reveals memory issues
for downstream code run under these exact conditions. Please report any
regression found.
There was a problem hiding this comment.
Darn, sorry, I should have checked more carefully. That substitution is definitely better. Sigh.
facbc08 to
239c9d4
Compare
|
OK, everything passed now, so let's get this in too. Thanks, @neutrinoceros! |
| @@ -0,0 +1,5 @@ | |||
| Fixed a crash that occurred for files opened via | |||
| ``fits.open(..., mode='update')``, on Windows, and with numpy 2.0 installed. | |||
| It is possible, though unlikely, that this patch reveals memory issues | |||
There was a problem hiding this comment.
Ah, actually, what I merged was your updated version. I'm really not quite with it tonight, but at least that means I happened to merge something I think addresses @eerovaher's critique. Though again apologies, @eerovaher, not to let you react first.
There was a problem hiding this comment.
The pull request has already been merged, but this looks good enough to me.
…/skip_windows_hack_on_numpy2 BUG: skip un-portable hack on windows + numpy2
| # flushing (on Windows--again, this is no problem on Linux). | ||
| # Note that this hack is only possible on numpy 1.x: | ||
| # in 2.x, we cannot write directly to the data attribute | ||
| for idx, mmap, arr in mmaps: |
There was a problem hiding this comment.
We should add a warning if there are references to the mmap array, accessing it will segault ! (which was the reason for this hack).
There was a problem hiding this comment.
Good point. I'll give this a try now.
There was a problem hiding this comment.
here it is #16608
please let me know if I've accurately implemented what you had in mind
Description
This is meant to fix #16578
The problematic block of code is clearly marked as a hack and the long comment goes on to explain that it shouldn't even be needed in most scenarios, so I think it might be okay to just skip the hack entirely on numpy 2.0 where it's not applicable. Let's see what CI has to say.