Close fd temp file following rec2csv_bad_shape test #971

Merged
merged 1 commit into from Jul 2, 2012

Conversation

Projects
None yet
4 participants
@jenshnielsen
Member

jenshnielsen commented Jun 29, 2012

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

@WeatherGod

This comment has been minimized.

Show comment
Hide comment
@WeatherGod

WeatherGod Jun 29, 2012

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.

Member

WeatherGod commented Jun 29, 2012

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

This comment has been minimized.

Show comment
Hide comment
@jdh2358

jdh2358 Jun 30, 2012

Collaborator

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

Collaborator

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

This comment has been minimized.

Show comment
Hide comment
@jenshnielsen

jenshnielsen Jul 1, 2012

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

Member

jenshnielsen commented Jul 1, 2012

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

This comment has been minimized.

Show comment
Hide comment
@mdboom

mdboom Jul 1, 2012

Member

+1

Member

mdboom commented Jul 1, 2012

+1

@WeatherGod

This comment has been minimized.

Show comment
Hide comment
@WeatherGod

WeatherGod Jul 2, 2012

Member

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

Member

WeatherGod commented Jul 2, 2012

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

mdboom added a commit that referenced this pull request Jul 2, 2012

Merge pull request #971 from jenshnielsen/close_test_file_v1_1_x
Close fd temp file following rec2csv_bad_shape test

@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