This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Fix ResourceWarning in difflib.py
Type: behavior Stage: resolved
Components: Demos and Tools, Documentation Versions: Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: docs@python Nosy List: David Bieber, Tiger-222, docs@python, terry.reedy
Priority: normal Keywords: patch

Created on 2018-08-25 15:09 by Tiger-222, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 8926 merged Tiger-222, 2018-08-25 15:15
Messages (5)
msg324071 - (view) Author: Mickaël Schoentgen (Tiger-222) * Date: 2018-08-25 15:09
Fix 2 unclosed files in the documentation and the difflib.py script:

diff.py:77: ResourceWarning: unclosed file <_io.TextIOWrapper name='/tmp/tmpnby8pemn' mode='U' encoding='UTF-8'>
    fromlines = open(fromfile, 'U').readlines()
diff.py:78: ResourceWarning: unclosed file <_io.TextIOWrapper name='/tmp/tmpnby8pemm' mode='U' encoding='UTF-8'>
    self.tolines = open(tofile, 'U').readlines()
msg324072 - (view) Author: Mickaël Schoentgen (Tiger-222) * Date: 2018-08-25 15:18
This is a little patch to mostly keep aligned with https://github.com/google/python-fire/pull/135.
msg324485 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2018-09-03 01:44
The change to Tools/scripts/diff.py us effectively a backport of the the patch merged for #7582. The git log  labels it as a2637729f23dc993e820fd92f0d1759ad714c9b2.

The change to Doc/library/difflib.rst does not apply to current 3.x as the test code is no longer present.
msg324486 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2018-09-03 01:48
New changeset 30af2e737aad427d4da97f8dadeeecff6c2b28f5 by Terry Jan Reedy (Mickaël Schoentgen) in branch '2.7':
bpo-34500: Fix ResourceWarning in difflib.py (GH-8926)
https://github.com/python/cpython/commit/30af2e737aad427d4da97f8dadeeecff6c2b28f5
msg324487 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2018-09-03 01:50
Using 'with open' is now standard.  Thanks for the update.
In the message above, /us/is/.
History
Date User Action Args
2022-04-11 14:59:05adminsetgithub: 78681
2018-09-03 01:50:50terry.reedysetstatus: open -> closed
type: behavior
messages: + msg324487

resolution: fixed
stage: patch review -> resolved
2018-09-03 01:48:17terry.reedysetmessages: + msg324486
2018-09-03 01:44:21terry.reedysetnosy: + terry.reedy
messages: + msg324485
2018-08-25 15:18:51Tiger-222setmessages: + msg324072
2018-08-25 15:15:23Tiger-222setkeywords: + patch
stage: patch review
pull_requests: + pull_request8397
2018-08-25 15:09:38Tiger-222create