Mercurial > public > mercurial-scm > hg-stable
diff mercurial/worker.py @ 49288:311fcc5a65f6
thirdparty: remove Python 2-specific selectors2 copy
The selectors module was added in Python 3.4. Because we require Python 3.6, it
will always be available. Therefore the selectors2 module is not imported.
I?ve verified that the selectors2-specific workaround in commandserver.py is not
necessary with the selectors module from the standard library. It returns an
empty list if timeout was exceeded.
The pytype directive was needed to silence the following error:
File "/tmp/mercurial-ci/mercurial/worker.py", line 299, in _posixworker: No attribute 'close' on int [attribute-error]
In Union[_typeshed.HasFileno, int]
File "/tmp/mercurial-ci/mercurial/worker.py", line 299, in _posixworker: No attribute 'close' on _typeshed.HasFileno [attribute-error]
In Union[_typeshed.HasFileno, int]
author | Manuel Jacob <me@manueljacob.de> |
---|---|
date | Sat, 28 May 2022 22:08:13 +0200 |
parents | 395f28064826 |
children | ee4537e365c8 |
line wrap: on
line diff
--- a/mercurial/worker.py Wed Jun 08 15:46:04 2022 +0200 +++ b/mercurial/worker.py Sat May 28 22:08:13 2022 +0200 @@ -9,18 +9,12 @@ import errno import os import pickle +import selectors import signal import sys import threading import time -try: - import selectors - - selectors.BaseSelector -except ImportError: - from .thirdparty import selectors2 as selectors - from .i18n import _ from . import ( encoding, @@ -304,7 +298,9 @@ yield res except EOFError: selector.unregister(key.fileobj) + # pytype: disable=attribute-error key.fileobj.close() + # pytype: enable=attribute-error openpipes -= 1 except IOError as e: if e.errno == errno.EINTR: