Patchwork windows: use os.SEEK_END

login
register
mail settings
Submitter Adrian Buehlmann
Date June 6, 2015, 12:12 p.m.
Message ID <021e68d37c5b38e49731.1433592726@kork>
Download mbox | patch
Permalink /patch/9545/
State Accepted
Headers show

Comments

Adrian Buehlmann - June 6, 2015, 12:12 p.m.
# HG changeset patch
# User Adrian Buehlmann <adrian@cadifra.com>
# Date 1433592235 -7200
# Node ID 021e68d37c5b38e497311fca2c83fda5ff988549
# Parent  6fabde6ef4453ee6c2aa964184f6cf2c54483621
windows: use os.SEEK_END
Pierre-Yves David - June 6, 2015, 8:43 p.m.
On 06/06/2015 05:12 AM, Adrian Buehlmann wrote:
> # HG changeset patch
> # User Adrian Buehlmann <adrian@cadifra.com>
> # Date 1433592235 -7200
> # Node ID 021e68d37c5b38e497311fca2c83fda5ff988549
> # Parent  6fabde6ef4453ee6c2aa964184f6cf2c54483621
> windows: use os.SEEK_END

Sure, pushed to the clowncopter.

Patch

diff --git a/mercurial/windows.py b/mercurial/windows.py
--- a/mercurial/windows.py
+++ b/mercurial/windows.py
@@ -26,7 +26,6 @@ 
 unlink = win32.unlink
 
 umask = 0022
-_SEEK_END = 2 # os.SEEK_END was introduced in Python 2.5
 
 def posixfile(name, mode='r', buffering=-1):
     '''Open a file with even more POSIX-like semantics'''
@@ -36,7 +35,7 @@ 
         # The position when opening in append mode is implementation defined, so
         # make it consistent with other platforms, which position at EOF.
         if 'a' in mode:
-            fp.seek(0, _SEEK_END)
+            fp.seek(0, os.SEEK_END)
 
         return fp
     except WindowsError, err: