8000 ENH: Add support for file like objects to np.core.records.fromfile by sidhant007 · Pull Request #16675 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

ENH: Add support for file like objects to np.core.records.fromfile #16675

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

Merged
merged 5 commits into from
Aug 13, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add comment for better explanation
  • Loading branch information
sidhant007 authored and mattip committed Aug 10, 2020
commit 09fdf11cd90e4dafd9d5ce5f012d99a858ba7d06
2 changes: 2 additions & 0 deletions numpy/core/records.py
Original file line number Diff line number Diff line change
Expand Up @@ -911,6 +911,8 @@ def fromfile(fd, dtype=None, shape=None, offset=0, formats=None,
shape = (shape,)

if hasattr(fd, 'readinto'):
# GH issue 2504. fd supports io.RawIOBase or io.BufferedIOBase interface.
# Example of fd: gzip, BytesIO, BufferedReader
# file already opened
ctx = contextlib_nullcontext(fd)
else:
Expand Down
0