Details
Details
- Reviewers
Alphare - Group Reviewers
hg-reviewers - Commits
- rHGa98e32e5fca1: windows: remove conditional for Python 3
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Branch
- default
- Lint
No Linters Available - Unit
No Unit Test Coverage
( )
Alphare |
hg-reviewers |
No Linters Available |
No Unit Test Coverage |
Path | Packages | |||
---|---|---|---|---|
M | mercurial/windows.py (3 lines) |
Commit | Parents | Author | Summary | Date |
---|---|---|---|---|
a6c959594a95 | de909aba4649 | Gregory Szorc | Feb 21 2022, 12:36 PM |
def posixfile(name, mode=b'r', buffering=-1): | def posixfile(name, mode=b'r', buffering=-1): | ||||
'''Open a file with even more POSIX-like semantics''' | '''Open a file with even more POSIX-like semantics''' | ||||
try: | try: | ||||
fp = osutil.posixfile(name, mode, buffering) # may raise WindowsError | fp = osutil.posixfile(name, mode, buffering) # may raise WindowsError | ||||
# PyFile_FromFd() ignores the name, and seems to report fp.name as the | # PyFile_FromFd() ignores the name, and seems to report fp.name as the | ||||
# underlying file descriptor. | # underlying file descriptor. | ||||
if pycompat.ispy3: | |||||
fp = fdproxy(name, fp) | fp = fdproxy(name, fp) | ||||
# The position when opening in append mode is implementation defined, so | # The position when opening in append mode is implementation defined, so | ||||
# make it consistent with other platforms, which position at EOF. | # make it consistent with other platforms, which position at EOF. | ||||
if b'a' in mode: | if b'a' in mode: | ||||
fp.seek(0, os.SEEK_END) | fp.seek(0, os.SEEK_END) | ||||
if b'+' in mode: | if b'+' in mode: | ||||
return mixedfilemodewrapper(fp) | return mixedfilemodewrapper(fp) |