Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions Doc/library/difflib.rst
Original file line number Diff line number Diff line change
Expand Up @@ -757,8 +757,10 @@ It is also contained in the Python source distribution, as
# we're passing these as arguments to the diff function
fromdate = time.ctime(os.stat(fromfile).st_mtime)
todate = time.ctime(os.stat(tofile).st_mtime)
fromlines = open(fromfile, 'U').readlines()
tolines = open(tofile, 'U').readlines()
with open(fromfile, 'U') as f:
fromlines = f.readlines()
with open(tofile, 'U') as f:
tolines = f.readlines()

if options.u:
diff = difflib.unified_diff(fromlines, tolines, fromfile, tofile,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix 2 ResourceWarning in difflib.py. Patch by Mickaël Schoentgen.
6 changes: 4 additions & 2 deletions Tools/scripts/diff.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@ def main():

fromdate = time.ctime(os.stat(fromfile).st_mtime)
todate = time.ctime(os.stat(tofile).st_mtime)
fromlines = open(fromfile, 'U').readlines()
tolines = open(tofile, 'U').readlines()
with open(fromfile, 'U') as f:
fromlines = f.readlines()
with open(tofile, 'U') as f:
tolines = f.readlines()

if options.u:
diff = difflib.unified_diff(fromlines, tolines, fromfile, tofile, fromdate, todate, n=n)
Expand Down