DOC: clarify NpzFile handling of non-.npy archive members#30893
DOC: clarify NpzFile handling of non-.npy archive members#30893LarytheLord wants to merge 1 commit intonumpy:mainfrom
NpzFile handling of non-.npy archive members#30893Conversation
NpzFile handling of non-.npy archive members
|
I'm not sure what |
There was a problem hiding this comment.
Pull request overview
This PR updates the NpzFile class documentation to accurately reflect its runtime behavior regarding non-.npy archive members. The original documentation incorrectly stated that files without a .npy extension are ignored, but the actual implementation loads them as raw bytes. This fixes issue #26004 by clarifying that .npy files are loaded as arrays while other files can be read as raw bytes.
Changes:
- Clarified that files with
.npyextension are loaded as NumPy arrays, while other files are returned as raw bytes - Updated the
filesattribute description to indicate it lists all archive members (not just.npyfiles), with.npyextensions removed where present - Updated the description text to accurately reflect that
.npyextension removal happens for all files in the archive
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Thanks for the note. You’re right: |
|
CI note: the current |
|
Closing this to reduce review load after opening too many PRs too quickly. I apologize for the noise. |
It's a Claudism. It likes to check that the Python it wrote is syntactically valid with |
|
Fair point, and thanks for calling it out. I should have validated this using NumPy’s documented |
Summary
numpy.lib.npyio.NpzFiledocs to match current runtime behavior.npymembers are loaded as arrays, while non-.npymembers are returned as raw bytesfilesattribute wording: it lists all archive members, with.npysuffix removed where presentCloses #26004.
Validation
python3 -m compileall numpy/lib/_npyio_impl.py