-
-
Notifications
You must be signed in to change notification settings - Fork 34.7k
bpo-30980: Fix double close in asyncore.file_wrapper #2789
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -433,7 +433,10 @@ def test_close_twice(self): | |
| f = asyncore.file_wrapper(fd) | ||
| os.close(fd) | ||
|
|
||
| f.close() | ||
| os.close(f.fd) # file_wrapper dupped fd | ||
| with self.assertRaises(OSError): | ||
| f.close() | ||
|
|
||
| self.assertEqual(f.fd, -1) | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Haypo isn't this ^^^^ good enough? Since file_wrapper.fd is not documented, maybe we should replace f.fd with f.fileno()? Do you want to add this change to the patch?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh, I missed it :-) It's enough. |
||
| # calling close twice should not fail | ||
| f.close() | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add this test here:
To test your fix.