-
-
Notifications
You must be signed in to change notification settings - Fork 884
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
Close the file descriptor for add_attachment #957
Conversation
I think you have addressed the problem correctly, but part of me wonders why this function is structured the way it is. Probably a future pull request though, so don't worry about it now. But perhaps I am missing a use case for when the file would already be open ? |
Hi, @adehad Thanks for your reply. The parameter document mentioned that the function could accept a file descriptor. Maybe I misunderstood something. |
Yep you are correct, i was just rambling to myself haha, sorry for the confusion. |
it would be nice if you would add a test uploading for example the README file as file descriptor and as string |
@studioj Thanks for your review. Remove the unused blocks |
@ssbarnea i think this can be merged |
@yen3 don't suppose you could run |
If the attachment is string, the add_attachment function creates a file descriptor then forget to close it. The patch closes the file descriptor after the post action.
@yen3 looks like there is still a minor linting problem, otherwise changes look good to me. |
@adehad Thanks for the review. I try to fix it. Please review it again. |
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.
added a minor comment on where we do the cast()
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.
oops, there's a cheeky black formatting error somewhere here
@adehad I run |
* Close the file descriptor for add_attachment If the attachment is string, the add_attachment function creates a file descriptor then forget to close it. The patch closes the file descriptor after the post action. * Pass a correct type for the variable * Convert type earliy * Refine code format
If the attachment argument is string, the add_attachment function creates a file descriptor then forget to close it. The patch closes the file descriptor after the post action.