##// END OF EJS Templates
posix: always seek to EOF when opening a file in append mode...
Augie Fackler -
r42778:97ada9b8 5.0.2 stable
parent child Browse files
Show More
@@ -30,7 +30,6 b' from . import ('
30 30
31 31 osutil = policy.importmod(r'osutil')
32 32
33 posixfile = open
34 33 normpath = os.path.normpath
35 34 samestat = os.path.samestat
36 35 try:
@@ -52,6 +51,19 b' expandglobs = False'
52 51 umask = os.umask(0)
53 52 os.umask(umask)
54 53
54 if not pycompat.ispy3:
55 def posixfile(name, mode=r'r', buffering=-1):
56 fp = open(name, mode=mode, buffering=buffering)
57 # The position when opening in append mode is implementation defined, so
58 # make it consistent by always seeking to the end.
59 if r'a' in mode:
60 fp.seek(0, os.SEEK_END)
61 return fp
62 else:
63 # The underlying file object seeks as required in Python 3:
64 # https://github.com/python/cpython/blob/v3.7.3/Modules/_io/fileio.c#L474
65 posixfile = open
66
55 67 def split(p):
56 68 '''Same as posixpath.split, but faster
57 69
General Comments 0
You need to be logged in to leave comments. Login now