Show More
@@ -30,7 +30,6 b' from . import (' | |||||
30 |
|
30 | |||
31 | osutil = policy.importmod(r'osutil') |
|
31 | osutil = policy.importmod(r'osutil') | |
32 |
|
32 | |||
33 | posixfile = open |
|
|||
34 | normpath = os.path.normpath |
|
33 | normpath = os.path.normpath | |
35 | samestat = os.path.samestat |
|
34 | samestat = os.path.samestat | |
36 | try: |
|
35 | try: | |
@@ -52,6 +51,19 b' expandglobs = False' | |||||
52 | umask = os.umask(0) |
|
51 | umask = os.umask(0) | |
53 | os.umask(umask) |
|
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 | def split(p): |
|
67 | def split(p): | |
56 | '''Same as posixpath.split, but faster |
|
68 | '''Same as posixpath.split, but faster | |
57 |
|
69 |
General Comments 0
You need to be logged in to leave comments.
Login now