Skip to content

BUG: memmap close files when it shouldn't, load leaves them open when it shouldn't #10551

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
Sep 24, 2018

Conversation

eric-wieser
Copy link
Member

This would be straightforward with ExitStack, but I don't feel like backporting something that big from py3k.

@eric-wieser
Copy link
Member Author

eric-wieser commented Feb 9, 2018

The diff in memmap isn't super clear because the level of indentation changed. In short:

  • When passed a raw file handle, wrap it in a null context that does nothing so it can go in a with statement
  • Do the cheap checks before opening the file

@eric-wieser eric-wieser force-pushed the better-file-ownership branch 2 times, most recently from b783fb3 to c736ea7 Compare February 9, 2018 05:46
Copy link
Contributor

@mhvk mhvk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Failures are just due to not adding the new null context manager to __all__

bytes = flen - offset
if bytes % _dbytes:
raise ValueError("Size of available data is not a "
"multiple of the data-type size.")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Strange indentation.

@mhvk
Copy link
Contributor

mhvk commented May 29, 2018

Want to wrap this up? From my comments, it seems there was only a trivial failure and an even more trivial nitpick to address.

@eric-wieser
Copy link
Member Author

__all__ entry added, and conditional nit addressed. Didn't mess with the formatting, because that's not part of this patch anyway

Copy link
Contributor

@mhvk mhvk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fine with ignoring the alignment for now.

@mhvk mhvk merged commit 8a1b011 into numpy:master Sep 24, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants