8000 BUG: Changed dump(a, F) so it would close file by orbit-stabilizer · Pull Request #10055 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

BUG: Changed dump(a, F) so it would close file #10055

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 4 commits into from
Nov 20, 2017
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
6 changes: 4 additions & 2 deletions numpy/ma/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -7818,8 +7818,10 @@ def dump(a, F):

"""
if not hasattr(F, 'readline'):
F = open(F, 'w')
return pickle.dump(a, F)
with open (F, 'w') as F:
pickle.dump(a, F)
else:
pickle.dump(a, F)
Copy link
Member

Choose a reason for hiding this comment

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

Style nit: 4-space indents, please.

There are other functions in this module that need the same fix, if you're going to fix this one.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, my bad.

I will fix any others I find.

I see now that I should have 'wb' instead of just 'w', as per #5491. Is there a way for me to change this without creating another pull request?

Copy link
Member

Choose a reason for hiding this comment

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

Leave the wb to a different PR - it's a separate problem, and I don't think we should fix it anyway.

Copy link
Member
@eric-wieser eric-wieser Nov 19, 2017

Choose a reason for hiding this comment

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

Is there a way for me to change this without creating another pull request?

I assume you're editing in the github web UI? You can navigate to your branch, and hit the edit button on the files there. It'll create a new commit, but we can squash them all together when you're done.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry, I didn't see your replies to this comment before I changed the wb. Yes, I'm using the Github web UI - I think I got it to work, thanks!



def dumps(a):
Expand Down
0