Skip to content

[2.7] bpo-30980: Fix double close in asyncore.file_wrapper #2900

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 1 commit into from
Jul 26, 2017

Conversation

nirs
Copy link
Contributor

@nirs nirs commented Jul 26, 2017

test_close_twice was not considering the fact that file_wrapper is
duping the file descriptor. Closing the original descriptor left the
duped one open, hiding the fact that close protection is not effective.

Invalidated self.fd before closing, handling correctly the case when
os.close raises.

  • bpo-30980: Fix fd leak introduced in the fixed test

https://bugs.python.org/issue30980

* bpo-30980: Fix close test to fail

test_close_twice was not considering the fact that file_wrapper is
duping the file descriptor. Closing the original descriptor left the
duped one open, hiding the fact that close protection is not effective.

* bpo-30980: Fix double close protection

Invalidated self.fd before closing, handling correctly the case when
os.close raises.

* bpo-30980: Fix fd leak introduced in the fixed test
@nirs
Copy link
Contributor Author

nirs commented Jul 26, 2017

@Haypo, @giampaolo, please review.

@vstinner vstinner merged commit 29094ce into python:2.7 Jul 26, 2017
@vstinner
Copy link
Member

When you backport, next time please use "git cherry-pick -x" to mention the commit sha1 in the commit message ;-)

@nirs nirs deleted the bpo-30980-2.7 branch October 1, 2022 22:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants