classification
Title: Fix potential resource warnings in distutils
Type: enhancement Stage: patch review
Components: Distutils Versions: Python 3.8
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: Tiger-222, dstufft, eric.araujo, serhiy.storchaka, xtreak
Priority: normal Keywords: patch

Created on 2018-12-05 08:54 by Tiger-222, last changed 2018-12-05 14:38 by Tiger-222.

Pull Requests
URL Status Linked Edit
PR 10918 open Tiger-222, 2018-12-05 08:59
Messages (5)
msg331097 - (view) Author: Mickaël Schoentgen (Tiger-222) * Date: 2018-12-05 08:54
I am looking to clean-up potential ResourceWarnings in distutils. The patch will provide 2 changes:
    - ensure file descriptor are always closed when it is not the case
    - and uniformization of the "with open(...)" use
msg331107 - (view) Author: Karthikeyan Singaravelan (xtreak) * (Python triager) Date: 2018-12-05 12:55
There is a similar open issue issue22831 with patches for distutils and Tools.
msg331110 - (view) Author: Mickaël Schoentgen (Tiger-222) * Date: 2018-12-05 13:10
I saw it but it is quite old and targetting 3.5. I opended this issue to target only distutils, easier to eventually backport than a big patch on a lot of files.
msg331114 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2018-12-05 14:08
I think the places that already use try/finally: close are correct.

We try to minimize churn in distutils; changing to with is nice but does not fix errors or warning in these cases.

The changes for the few spots that don’t use finally: close are welcome though!
msg331118 - (view) Author: Mickaël Schoentgen (Tiger-222) * Date: 2018-12-05 14:38
OK then I updated the PR to only update code that would really leak resources.
History
Date User Action Args
2018-12-05 14:38:17Tiger-222setmessages: + msg331118
2018-12-05 14:08:14eric.araujosetmessages: + msg331114
2018-12-05 13:10:06Tiger-222setmessages: + msg331110
2018-12-05 12:55:57xtreaksetnosy: + serhiy.storchaka, xtreak
messages: + msg331107
2018-12-05 08:59:35Tiger-222setkeywords: + patch
stage: patch review
pull_requests: + pull_request10157
2018-12-05 08:54:19Tiger-222create