posix: delete Python 2 posixfile()
authorGregory Szorc <gregory.szorc@gmail.com>
Thu, 03 Mar 2022 08:04:33 -0800
changeset 48885 a2c59b361e0f
parent 48884 7f5e91cdebcd
child 48886 127cc4535853
posix: delete Python 2 posixfile() The comment no longer makes sense since the stdlib open() behaves the way we want on Python 3. So it was removed. Differential Revision: https://phab.mercurial-scm.org/D12288
mercurial/posix.py
--- a/mercurial/posix.py	Mon Feb 21 10:21:18 2022 -0700
+++ b/mercurial/posix.py	Thu Mar 03 08:04:33 2022 -0800
@@ -59,21 +59,7 @@
 umask = os.umask(0)
 os.umask(umask)
 
-if not pycompat.ispy3:
-
-    def posixfile(name, mode='r', buffering=-1):
-        fp = open(name, mode=mode, buffering=buffering)
-        # The position when opening in append mode is implementation defined, so
-        # make it consistent by always seeking to the end.
-        if 'a' in mode:
-            fp.seek(0, os.SEEK_END)
-        return fp
-
-
-else:
-    # The underlying file object seeks as required in Python 3:
-    # https://github.com/python/cpython/blob/v3.7.3/Modules/_io/fileio.c#L474
-    posixfile = open
+posixfile = open
 
 
 def split(p):