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.
|
|
Side note: I don't want to mess with it in this PR to not mix things up, but it seems the LZMA magic is not being properly checked on Lines 429 to 436 in e2b2a2a Only the first 3 bytes are being checked, but technically the correct magic is 6 bytes long. This means that in theory we could have some false positives (though probably rare, not sure how much we should care about this). |
|
Thanks for the PR, looks good but just needs some tests (for which you could replicate the bz2 tests). |
|
Added tests now and also found some places where the documentation needed to be updated accordingly. I believe this is now ready. |
|
Added a few edge cases that were missing. Ready for final review. |
| raise ModuleNotFoundError( | ||
| "This Python installation does not provide the lzma module." | ||
| ) | ||
| new_file = lzma.LZMAFile(name, mode="w") |
There was a problem hiding this comment.
I just mimicked the bz2 case in _flush_resize, but I frankly don't fully understand what's happening here. I don't think we have any test case covering this for either gzip, bz2 or lzma, so this wasn't triggering any CI errors. I guess we should create a test case for when a resize is triggered, but I'm not sure what the best approach for that is.
There was a problem hiding this comment.
Hmm we explicitly forbid use of update mode with bz2 (and xz) so I don't think this case can be triggered. Would need a deeper dive to check that, but no need to hold that PR because of that.
Description
This pull request is to address the lack of LZMA support in
io.fits. Fixes #9714Header magic needs to be expanded to 6 bytes because that's the size of LZMA's (at least according to both The Tukaani Project and Wikipedia). The existing code was already doing
magic.startswith, so this should not conflict with the other detections.The code added is a near copy-paste of the code for bz2, but it seems to work fine. I'll add tests later.