Skip to content

Close fd temp file following rec2csv_bad_shape test #971

Merged
merged 1 commit into from Jul 2, 2012

4 participants

@jenshnielsen
Matplotlib Developers member

This avoids a warning in python3 about the unclosed file
and potential side effects of the open file.

@WeatherGod
Matplotlib Developers member

Shouldn't it close when the object goes out of scope anyway? I don't see any harm in including this code (the ValueError exception should still bubble up to nose). I just wanted to make sure I understood tempfile correctly.

@jdh2358
Matplotlib Developers member
jdh2358 commented Jun 30, 2012

If this is a fix for python3, shouldn't it go against master rather than 1.1.x, which doesn't support python3?

@jenshnielsen
Matplotlib Developers member

Well I can rebase it against master and thats fine with me, but I believe the behavior is the same on the different python versions the only difference is that python 3 gives the not closed warning while python2 does not, thus it seems like a good idea to close the temp file in any case.
I think the tempfile is closed when it goes out of scope but I think the main point is that the file is destroyed when it is closed. http://docs.python.org/library/tempfile.html

@mdboom
Matplotlib Developers member
mdboom commented Jul 1, 2012

+1

@WeatherGod
Matplotlib Developers member

In any case, explicit is better than implicit. I am fine with it being merged in.

@mdboom mdboom merged commit 2c85848 into matplotlib:v1.1.x Jul 2, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.