Mercurial > hg
changeset 49291:1bf3eb65e970
py3: remove dead code to open file with O_CLOEXEC on Python 2
The O_CLOEXEC flag is passed by default on Python 3.
author | Manuel Jacob <me@manueljacob.de> |
---|---|
date | Sun, 29 May 2022 16:24:44 +0200 |
parents | 76f56d69a457 |
children | 33872fec41e7 |
files | hgext/remotefilelog/basepack.py |
diffstat | 1 files changed, 2 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/remotefilelog/basepack.py Tue May 31 01:16:41 2022 +0200 +++ b/hgext/remotefilelog/basepack.py Sun May 29 16:24:44 2022 +0200 @@ -13,7 +13,6 @@ from mercurial.node import hex from mercurial import ( policy, - pycompat, util, vfs as vfsmod, ) @@ -54,14 +53,6 @@ # loaded the pack list. REFRESHRATE = 0.1 -if pycompat.isposix and not pycompat.ispy3: - # With glibc 2.7+ the 'e' flag uses O_CLOEXEC when opening. - # The 'e' flag will be ignored on older versions of glibc. - # Python 3 can't handle the 'e' flag. - PACKOPENMODE = b'rbe' -else: - PACKOPENMODE = b'rb' - class _cachebackedpacks: def __init__(self, packs, cachesize): @@ -343,12 +334,12 @@ self._data.close() # TODO: use an opener/vfs to access these paths - with open(self.indexpath, PACKOPENMODE) as indexfp: + with open(self.indexpath, b'rb') as indexfp: # memory-map the file, size 0 means whole file self._index = mmap.mmap( indexfp.fileno(), 0, access=mmap.ACCESS_READ ) - with open(self.packpath, PACKOPENMODE) as datafp: + with open(self.packpath, b'rb') as datafp: self._data = mmap.mmap(datafp.fileno(), 0, access=mmap.ACCESS_READ) self._pagedin = 0