[Numpy-discussion] Fixing fromfile to throw error when opening on gzip files

Sidhant Bansal sidhbansal at gmail.com
Thu Jun 4 02:56:52 EDT 2020


In regard to the issue: https://github.com/numpy/numpy/issues/7713
And my corresponding PR: https://github.com/numpy/numpy/pull/16221

I was advised to put this on the mailing list to get a general sense of how
the issue is affecting people and to discuss how I can improve the current
PR.

I am still interested in resolving this issue, so will be glad to do some
re-work to be able to get this merged and fix the issue.

The currently proposed PR is a kind of band-aid solution which uses an
if-else chunk in the `fromfile` function's internal implementation to catch
if the file opened is gzip type or not and throws an error.

The drawback lies in the fact that we only are able to resolve gzip type
issue and is not extendable to other high level file types which cant be
opened.

In my findings, I was unable to find a common distinguishing feature for
those file types which cannot be opened using fromfile vs those which can
be (ex. In a hypothetical situation one kind has the read method and other
doesn't).

Would love to hear what other people think and if they have any inputs
about the what possible common distinguishing features can be there or if
we should simply cross-check the file type against a hard-coded list of
common high-level file types?

Sidhant.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20200604/bf556c78/attachment.html>


More information about the NumPy-Discussion mailing list