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
Fix svg writer for StringIO objects #1380
Conversation
Also, |
This seems to have created a new Travis failure about seeking on a closed file. Needs further investigation. |
Regardless of the closing, I can confirm that the initial fix does the trick. Thanks. |
I assumed one would not seek the file once the figure has been written. Maybe I shouldn't assume this. Investigating... |
I see the problem. The test re-reads the saved figure to test that it's a valid svg file. There are two options:
I think I should probably undo the close change and assume the user doesn't want specially constructed file descriptors closed. Thoughts? |
Ok, I'm making a decision. This PR should fix the original problem and not try to fiddle with other things. I will undo the close change and keep the original solution. |
I think that's right, having just looked at this again. I think the intent is that only things that are created within that function should be closed. |
@mdboom Yeah. I think I'd be annoyed if functions started freeing memory when I didn't expect it. The tests pass now, too. |
Great! Merging. |
Fix svg writer for StringIO objects
Fix #1373.
This seems like a really simple fix. I'm a little concerned that it may now be possible to pass something to
print_svg
that doesn't make sense. Hopefully someone will correct me if this is the case.Also, I kind of feel like the write should be in a
try
/finally
block, likeprint_png
in theagg
backend.