gh-85567: Register a cleanup function to close files for FileType objects in argparse#32257
Conversation
…jects in argparse
|
Hello, and thanks for your contribution! I'm a bot set up to make sure that the project can legally accept this contribution by verifying everyone involved has signed the PSF contributor agreement (CLA). CLA MissingOur records indicate the following people have not signed the CLA: For legal reasons we need all the people listed to sign the CLA before we can look at your contribution. Please follow the steps outlined in the CPython devguide to rectify this issue. If you have recently signed the CLA, please wait at least one business day You can check yourself to see if the CLA has been received. Thanks again for the contribution, we look forward to reviewing it! |
I had signed the CLA last night, so just waiting for it to be processed. |
|
Hi @facundobatista @serhiy-storchaka, As both of you had reviewed PR-21702 and this follows up on that, would you be available to review this? |
facundobatista
left a comment
There was a problem hiding this comment.
Hello! Thanks for the work! I annotated a couple of small suggestions.
|
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
|
Thanks for taking a look @facundobatista! I have made the requested changes; please review again |
|
Thanks for making the requested changes! @facundobatista: please review the changes made to this pull request. |
facundobatista
left a comment
There was a problem hiding this comment.
It looks great! Thanks!
BPO-41395
make patchcheckHello! First-time contribution, I've read through what I believe to be the relevant sections in the Python Developer's Guide, however, feel free to let me know if there is something I missed.
This is a follow-up to PR-21702, where it was suggested to address the
ResourceWarningissue directly inargparseitself. However, as that was discussed back in 2020, I've attempted to take a stab at it myself! After reading a suggestion from @facundobatista, I have added afile.closecleanup function withatexitfor files opened withFileTypeobjects, to ensure they are always closed.Previously:
With Patch:
https://bugs.python.org/issue41395